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.
| 修飾子とタイプ | フィールドと説明 |
|---|---|
static AllocationListener |
NOOP |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
onAllocation(long size)
Called each time a new buffer is allocated
|
void |
onChildAdded(BufferAllocator parentAllocator,
BufferAllocator childAllocator)
Called immediately after a child allocator was added to the parent allocator
|
void |
onChildRemoved(BufferAllocator parentAllocator,
BufferAllocator childAllocator)
Called immediately after a child allocator was removed from the parent allocator
|
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 failedvoid onChildAdded(BufferAllocator parentAllocator, BufferAllocator childAllocator)
parentAllocator - The parent allocator to which a child was addedchildAllocator - The child allocator that was just addedvoid onChildRemoved(BufferAllocator parentAllocator, BufferAllocator childAllocator)
parentAllocator - The parent allocator from which a child was removedchildAllocator - The child allocator that was just removedCopyright © 2018 The Apache Software Foundation. All rights reserved.