public interface AllocationListener
It might be called from multiple threads if the allocator hierarchy shares a listener, in which case, the provider should take care of making the implementation thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static AllocationListener |
NOOP |
| Modifier and Type | Method and Description |
|---|---|
void |
onAllocation(long size)
Called each time a new buffer is allocated
|
boolean |
onFailedAllocation(long size,
AllocationOutcome outcome)
Called whenever an allocation failed, giving the caller a chance to create some space in the allocator
(either by freeing some resource, or by changing the limit), and, if successful, allowing the allocator
to retry the allocation.
|
static final AllocationListener NOOP
void onAllocation(long size)
size - the buffer size being allocatedboolean onFailedAllocation(long size,
AllocationOutcome outcome)
size - the buffer size that was being allocatedoutcome - the outcome of the failed allocation. Carries information of what failedCopyright © 2018 The Apache Software Foundation. All rights reserved.