|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.io.DirectBufferPoolAllocator
public class DirectBufferPoolAllocator
An allocator for ByteBuffer slices backed by direct
ByteBuffers allocated against a DirectBufferPool.
DirectBufferPoolAllocator.IAllocation generic
using a factory pattern (we need UUID for scale-out, but the
class could be reused for other purposes as well). [The allocation
context identifier should continue to be an application specified
object.]| Nested Class Summary | |
|---|---|
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 ByteBuffers on which allocations have been made by
the application. |
| Constructor Summary | |
|---|---|
DirectBufferPoolAllocator(DirectBufferPool pool)
|
|
| Method Summary | |
|---|---|
void |
close()
Releases all DirectBufferPoolAllocator.IAllocationContexts 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DirectBufferPoolAllocator(DirectBufferPool pool)
pool - The pool from which the direct ByteBuffers are
allocated.| Method Detail |
|---|
protected void finalize()
throws Throwable
close() the allocator.
finalize in class ObjectThrowablepublic void close()
DirectBufferPoolAllocator.IAllocationContexts 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||