Class NamedMemoryLimiter
- java.lang.Object
-
- org.apache.cassandra.index.sai.utils.NamedMemoryLimiter
-
@ThreadSafe public final class NamedMemoryLimiter extends java.lang.Object
A simple, thread-safe memory usage tracker, named to reflect a particular scope.
-
-
Constructor Summary
Constructors Constructor Description NamedMemoryLimiter(long limitBytes, java.lang.String scope)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
currentBytesUsed()
long
decrement(long bytes)
long
increment(long bytes)
long
limitBytes()
void
setLimitBytes(long bytes)
boolean
usageExceedsLimit()
-
-
-
Method Detail
-
usageExceedsLimit
public boolean usageExceedsLimit()
- Returns:
- true if the current number of bytes allocated against the tracker has breached the limit, false otherwise
-
increment
public long increment(long bytes)
-
decrement
public long decrement(long bytes)
-
currentBytesUsed
public long currentBytesUsed()
-
limitBytes
public long limitBytes()
-
setLimitBytes
public void setLimitBytes(long bytes)
-
-