public class DirectBufferPoolAllocator extends Object
ByteBuffer
slices backed by direct
ByteBuffer
s allocated against a DirectBufferPool
.Modifier and Type | Class and Description |
---|---|
static interface |
DirectBufferPoolAllocator.IAllocation
An allocation against a direct
ByteBuffer . |
static interface |
DirectBufferPoolAllocator.IAllocationContext
An allocation context links some application specified key with a list
of direct
ByteBuffer s on which allocations have been made by
the application. |
Constructor and Description |
---|
DirectBufferPoolAllocator(DirectBufferPool pool) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases all
AllocationContext s and all direct ByteBuffer
s which they are using. |
protected void |
finalize()
Extended to
close() the allocator. |
DirectBufferPoolAllocator.IAllocation |
getAllocation(UUID id)
Return the allocation associated with that id.
|
DirectBufferPoolAllocator.IAllocationContext |
getAllocationContext(Object key)
Return an allocation context for the key.
|
int |
getMaxSlotSize()
The maximum #of bytes in a single
DirectBufferPoolAllocator.IAllocation . |
static void |
put(byte[] src,
DirectBufferPoolAllocator.IAllocation[] a)
Copy the caller's data onto the ordered array of allocations.
|
static void |
put(ByteBuffer src,
DirectBufferPoolAllocator.IAllocation[] a)
Copy the caller's data onto the ordered array of allocations.
|
public DirectBufferPoolAllocator(DirectBufferPool pool)
pool
- The pool from which the direct ByteBuffer
s are
allocated.public void close()
AllocationContext
s and all direct ByteBuffer
s which they are using.public int getMaxSlotSize()
DirectBufferPoolAllocator.IAllocation
.public DirectBufferPoolAllocator.IAllocationContext getAllocationContext(Object key)
key
- A key which uniquely identifies that context. The key will be
inserted into a hash table and therefore must have appropriate
hashCode() and equals() methods.public DirectBufferPoolAllocator.IAllocation getAllocation(UUID id)
id
- The allocation identifier.null
if there is no such
allocation.public static void put(byte[] src, DirectBufferPoolAllocator.IAllocation[] a)
allocation
will be
advanced by the #of bytes copied into that allocation.src
- The source data.a
- The allocations.BufferOverflowException
- if there is not enough room in the allocations for the data
to be copied.public static void put(ByteBuffer src, DirectBufferPoolAllocator.IAllocation[] a)
allocation
will be
advanced by the #of bytes copied into that allocation.src
- The source data.a
- The allocations.BufferOverflowException
- if there is not enough room in the allocations for the data
to be copied.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.