public abstract class BufferAllocator
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXECUTION
Special owner indicating execution pool memory.
|
static java.lang.String |
STORE_DATA_FRAME_OUTPUT |
| Constructor and Description |
|---|
BufferAllocator() |
| Modifier and Type | Method and Description |
|---|---|
abstract java.nio.ByteBuffer |
allocate(int size,
java.lang.String owner)
Allocate a new ByteBuffer of given size.
|
java.nio.ByteBuffer |
allocateCustom(int size,
FreeMemory.Factory factory)
Allocate a buffer passing a custom FreeMemoryFactory.
|
abstract java.nio.ByteBuffer |
allocateForStorage(int size)
Allocate a new ByteBuffer of given size for storage in a Region.
|
java.nio.ByteBuffer |
allocateWithFallback(int size,
java.lang.String owner)
Allocate using the default allocator and fallback to base JDK one in case
allocation fails due to some reason (e.g.
|
abstract java.lang.Object |
baseObject(java.nio.ByteBuffer buffer)
Get the base object of the ByteBuffer for raw reads/writes by Unsafe API.
|
abstract long |
baseOffset(java.nio.ByteBuffer buffer)
Get the base offset of the ByteBuffer for raw reads/writes by Unsafe API.
|
abstract void |
clearPostAllocate(java.nio.ByteBuffer buffer,
int position)
Clears the memory to be zeros immediately after allocation
from given position to end.
|
abstract void |
close()
Any cleanup required at system close.
|
abstract java.nio.ByteBuffer |
expand(java.nio.ByteBuffer buffer,
int required,
java.lang.String owner)
Expand given ByteBuffer to new capacity.
|
protected static int |
expandedSize(int currentUsed,
int required) |
void |
fill(java.nio.ByteBuffer buffer,
byte b)
Fill the buffer from its current position to full capacity with given byte.
|
void |
fill(java.nio.ByteBuffer buffer,
byte b,
int position,
int numBytes)
Fill the given portion of the buffer setting it with given byte.
|
abstract java.nio.ByteBuffer |
fromBytesToStorage(byte[] bytes,
int offset,
int length)
Return a ByteBuffer either copying from, or sharing the given heap bytes.
|
abstract boolean |
isDirect()
Indicates if this allocator will produce direct ByteBuffers.
|
boolean |
isManagedDirect()
Return true if this is a managed direct buffer allocator.
|
void |
release(java.nio.ByteBuffer buffer)
For direct ByteBuffers the release method is preferred to eagerly release
the memory instead of depending on heap GC which can be delayed.
|
static boolean |
releaseBuffer(java.nio.ByteBuffer buffer)
For direct ByteBuffers the release method is preferred to eagerly release
the memory instead of depending on heap GC which can be delayed.
|
byte[] |
toBytes(java.nio.ByteBuffer buffer)
Return the data as a heap byte array.
|
java.nio.ByteBuffer |
transfer(java.nio.ByteBuffer buffer,
java.lang.String owner)
Return a ByteBuffer either sharing data of given ByteBuffer
if its type matches, or else copying from the given ByteBuffer.
|
public static final java.lang.String STORE_DATA_FRAME_OUTPUT
public static final java.lang.String EXECUTION
public abstract java.nio.ByteBuffer allocate(int size,
java.lang.String owner)
public java.nio.ByteBuffer allocateWithFallback(int size,
java.lang.String owner)
public abstract java.nio.ByteBuffer allocateForStorage(int size)
public abstract void clearPostAllocate(java.nio.ByteBuffer buffer,
int position)
public final void fill(java.nio.ByteBuffer buffer,
byte b,
int position,
int numBytes)
public final void fill(java.nio.ByteBuffer buffer,
byte b)
public abstract java.lang.Object baseObject(java.nio.ByteBuffer buffer)
public abstract long baseOffset(java.nio.ByteBuffer buffer)
public abstract java.nio.ByteBuffer expand(java.nio.ByteBuffer buffer,
int required,
java.lang.String owner)
public byte[] toBytes(java.nio.ByteBuffer buffer)
public abstract java.nio.ByteBuffer fromBytesToStorage(byte[] bytes,
int offset,
int length)
public java.nio.ByteBuffer transfer(java.nio.ByteBuffer buffer,
java.lang.String owner)
public final void release(java.nio.ByteBuffer buffer)
public static boolean releaseBuffer(java.nio.ByteBuffer buffer)
public abstract boolean isDirect()
public boolean isManagedDirect()
public java.nio.ByteBuffer allocateCustom(int size,
FreeMemory.Factory factory)
public abstract void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableprotected static int expandedSize(int currentUsed,
int required)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.