public class ResourceLimiter extends Object
Constructor and Description |
---|
ResourceLimiter(long maxHeapSize,
int maxInFlightRpcs)
Constructor for ResourceLimiter.
|
Modifier and Type | Method and Description |
---|---|
long |
getHeapSize()
getHeapSize.
|
long |
getMaxHeapSize()
Getter for the field
maxHeapSize . |
int |
getMaxInFlightRpcs()
Getter for the field
maxInFlightRpcs . |
boolean |
hasInflightRequests()
hasInflightRequests.
|
boolean |
isFull()
isFull.
|
void |
markCanBeCompleted(long id)
Mark an operation id, as returned by
registerOperationWithHeapSize , as complete |
long |
registerOperationWithHeapSize(long heapSize)
Register an operation with the given size before sending.
|
public ResourceLimiter(long maxHeapSize, int maxInFlightRpcs)
Constructor for ResourceLimiter.
maxHeapSize
- a long.maxInFlightRpcs
- a int.public long registerOperationWithHeapSize(long heapSize) throws InterruptedException
markCanBeCompleted
in order to make sure
resources are properly released.heapSize
- The serialized size of the RPC to be sentInterruptedException
- if any.public void markCanBeCompleted(long id)
registerOperationWithHeapSize
, as completeid
- a long.public long getMaxHeapSize()
Getter for the field maxHeapSize
.
public int getMaxInFlightRpcs()
Getter for the field maxInFlightRpcs
.
public long getHeapSize()
getHeapSize.
public boolean isFull()
isFull.
public boolean hasInflightRequests()
hasInflightRequests.