public class MemoryTracker
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
MemoryTracker.MemoryLease |
Constructor and Description |
---|
MemoryTracker(org.apache.kafka.common.utils.Time time,
long poolSize) |
MemoryTracker(org.apache.kafka.common.utils.Time time,
org.apache.kafka.common.metrics.Metrics metrics,
long poolSize) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
isDisabled()
Returns true if this MemoryTracker is disabled.
|
long |
leased()
Returns the number of bytes currently leased
|
MemoryTracker.MemoryLease |
newLease(CancellationContext ctx,
long amount)
Creates a new MemoryLease if the pool contains a positive amount of bytes.
|
long |
poolSize() |
void |
setPoolSize(long newPoolSize)
Set a new pool size for the Memory Tracker.
|
java.util.Optional<MemoryTracker.MemoryLease> |
tryLease(long amount)
Like newLease, this will attempt to create a new MemoryLease for the provided amount of
bytes.
|
void |
wakeup()
Wakeup all threads which are waiting on a memory lease.
|
public MemoryTracker(org.apache.kafka.common.utils.Time time, long poolSize)
public MemoryTracker(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.metrics.Metrics metrics, long poolSize)
public void setPoolSize(long newPoolSize)
public boolean isDisabled()
public MemoryTracker.MemoryLease newLease(CancellationContext ctx, long amount)
public java.util.Optional<MemoryTracker.MemoryLease> tryLease(long amount)
public long leased()
public long poolSize()
public void wakeup()
public void close()
close
in interface java.lang.AutoCloseable