ByteBuffers. It's possible to work
either with direct or heap ByteBuffers.
MemoryManager, ByteBuffer
| Modifier and Type | Class and Description |
|---|---|
| private static class | ByteBufferManager.
Information about thread associated memory pool. |
| protected class | ByteBufferManager.
|
| private class | ByteBufferManager.
|
| Modifier and Type | Field and Description |
|---|---|
| private static final ThreadCache. | |
| public static final int | DEFAULT_SMALL_BUFFER_SIZE
Todo Document |
| protected boolean | isDirect
Is direct ByteBuffer should be used? |
| protected final int | |
| private final ThreadCache. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBufferWrapper | allocate(final int size)
Implements org. Allocated |
| public ByteBufferWrapper | allocateAtLeast(int size)
Implements org. Allocated |
| public ByteBuffer | Returns: allocatedByteBuffer.ByteBuffer size.Implements org. Allocates |
| protected final ByteBuffer | |
| public ByteBuffer | Returns: allocatedByteBuffer.ByteBuffer size.Implements org. Allocates |
| protected Object | Returns: the Memory Manager JMX management object.Implements abstract org. Create the Memory Manager JMX management object. |
| protected ByteBufferManager. | |
| public ThreadLocalPool | |
| private ByteBufferManager. | |
| private static ByteBufferManager. | |
| public int | |
| public MonitoringConfig | getMonitoringConfig()
Implements org. Return the object associated |
| public boolean | Returns: true, if ByteBufferManager works with directByteBuffers, or false
otherwise.Returns true, if ByteBufferManager works with direct |
| public ByteBufferWrapper | reallocate(ByteBufferWrapper oldBuffer, int newSize)
Implements org. Reallocate |
| public ByteBuffer | reallocateByteBuffer(ByteBuffer oldByteBuffer, int newSize)
Implements org.
|
| private void | |
| public void | release(ByteBufferWrapper buffer)
Implements org. Lets JVM Garbage collector to release buffer. |
| public void | releaseByteBuffer(ByteBuffer byteBuffer)
Implements org.
|
| public void | setDirect(boolean
true, if ByteBufferManager works with direct isDirect)ByteBuffers, or false
otherwise.Set true, if ByteBufferManager works with direct |
| public boolean | willAllocateDirect(int size)
Implements org. Return true if next |
| public ByteBufferWrapper | wrap(byte[] data)
Implements org. Returns |
| public ByteBufferWrapper | wrap(byte[] data, int offset, int length)
Implements org. Returns |
| public ByteBufferWrapper | |
| public ByteBufferWrapper | |
| public ByteBufferWrapper | wrap(final ByteBuffer byteBuffer)
Implements org. Returns |
| CACHE_IDX | back to summary |
|---|---|
| private static final ThreadCache. | |
| DEFAULT_SMALL_BUFFER_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_SMALL_BUFFER_SIZE Todo Document | |
| isDirect | back to summary |
|---|---|
| protected boolean isDirect Is direct ByteBuffer should be used? | |
| maxSmallBufferSize | back to summary |
|---|---|
| protected final int maxSmallBufferSize | |
| SMALL_BUFFER_CACHE_IDX | back to summary |
|---|---|
| private final ThreadCache. | |
| ByteBufferManager | back to summary |
|---|---|
| public ByteBufferManager() | |
| ByteBufferManager | back to summary |
|---|---|
| public ByteBufferManager(final boolean isDirect) | |
| ByteBufferManager | back to summary |
|---|---|
| public ByteBufferManager(final boolean isDirect, final int maxBufferSize, final int maxSmallBufferSize) | |
| allocate | back to summary |
|---|---|
| public ByteBufferWrapper allocate(final int size) Implements org. Doc from org. Allocated
| |
| allocateAtLeast | back to summary |
|---|---|
| public ByteBufferWrapper allocateAtLeast(int size) Implements org. Doc from org. Allocated
| |
| allocateByteBuffer | back to summary |
|---|---|
| public ByteBuffer allocateByteBuffer(final int size) Implements org. Allocates
| |
| allocateByteBuffer0 | back to summary |
|---|---|
| protected final ByteBuffer allocateByteBuffer0(final int size) | |
| allocateByteBufferAtLeast | back to summary |
|---|---|
| public ByteBuffer allocateByteBufferAtLeast(final int size) Implements org. Allocates
| |
| createJmxManagementObject | back to summary |
|---|---|
| protected Object createJmxManagementObject() Implements abstract org. Create the Memory Manager JMX management object. | |
| createSmallBuffer | back to summary |
|---|---|
| protected ByteBufferManager. | |
| createThreadLocalPool | back to summary |
|---|---|
| public ThreadLocalPool Implements org.
| |
| createTrimAwareBuffer | back to summary |
|---|---|
| private ByteBufferManager. | |
| getByteBufferThreadLocalPool | back to summary |
|---|---|
private static ByteBufferManager.
| |
| getMaxSmallBufferSize | back to summary |
|---|---|
| public int getMaxSmallBufferSize() | |
| getMonitoringConfig | back to summary |
|---|---|
| public MonitoringConfig Implements org. Doc from org. Return the object associated
| |
| isDirect | back to summary |
|---|---|
| public boolean isDirect() Returns true, if ByteBufferManager works with direct
| |
| reallocate | back to summary |
|---|---|
| public ByteBufferWrapper reallocate(ByteBufferWrapper oldBuffer, int newSize) Implements org. Doc from org. Reallocate
| |
| reallocateByteBuffer | back to summary |
|---|---|
| public ByteBuffer reallocateByteBuffer(ByteBuffer oldByteBuffer, int newSize) Implements org.
| |
| reallocatePoolBuffer | back to summary |
|---|---|
private void reallocatePoolBuffer()
| |
| release | back to summary |
|---|---|
| public void release(ByteBufferWrapper buffer) Implements org. Lets JVM Garbage collector to release buffer.
| |
| releaseByteBuffer | back to summary |
|---|---|
| public void releaseByteBuffer(ByteBuffer byteBuffer) Implements org.
| |
| setDirect | back to summary |
|---|---|
| public void setDirect(boolean isDirect) Set true, if ByteBufferManager works with direct
| |
| willAllocateDirect | back to summary |
|---|---|
| public boolean willAllocateDirect(int size) Implements org. Doc from org. Return true if next
| |
| wrap | back to summary |
|---|---|
| public ByteBufferWrapper wrap(byte[] data) Implements org. Doc from org. Returns
| |
| wrap | back to summary |
|---|---|
| public ByteBufferWrapper wrap(byte[] data, int offset, int length) Implements org. Doc from org. Returns
| |
| wrap | back to summary |
|---|---|
| public ByteBufferWrapper wrap(String s) Implements org. Doc from org. Returns
| |
| wrap | back to summary |
|---|---|
| public ByteBufferWrapper wrap(String s, Charset charset) Implements org. Doc from org. Returns
| |
| wrap | back to summary |
|---|---|
| public ByteBufferWrapper wrap(final ByteBuffer byteBuffer) Implements org. Doc from org. Returns
| |
| Modifier and Type | Field and Description |
|---|---|
| private Object[] | allocationHistory
|
| private int | |
| private ByteBuffer | pool
Memory pool |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private ByteBuffer | |
| public ByteBuffer | allocate(int size)
Implements org. Creates a buffer with a given capacity and limit |
| public boolean | hasRemaining()
Implements org. Whether there are elements between the current position and the end |
| public boolean | isLastAllocated(ByteBuffer oldByteBuffer)
Implements org. Whether the last element in the buffer has been set |
| public ByteBuffer | reallocate(ByteBuffer oldByteBuffer, int newSize)
Implements org. Creates a new Buffer with a set size and assigns it the data that was held in the old one as long as the given size is not smaller than the data held. |
| public ByteBuffer | reduceLastAllocated(ByteBuffer byteBuffer)
Implements org. Reduces the buffer to the last data allocated |
| public boolean | release(ByteBuffer underlyingBuffer)
Implements org. deallocates the data in the buffer |
| public int | remaining()
Implements org. Gets the number of elements between the current position and the limit |
| public void | reset(ByteBuffer pool)
Implements org. Resets the Buffer to empty values and empties the pool |
| public String | |
| public boolean | wantReset(int size)
Implements org. Checks if the size of the Buffer should be reset. |
| allocationHistory | back to summary |
|---|---|
| private Object[] allocationHistory
| |
| lastAllocatedIndex | back to summary |
|---|---|
| private int lastAllocatedIndex | |
| pool | back to summary |
|---|---|
| private ByteBuffer pool Memory pool | |
| ByteBufferThreadLocalPool | back to summary |
|---|---|
| public ByteBufferThreadLocalPool() | |
| addHistory | back to summary |
|---|---|
| private ByteBuffer addHistory(ByteBuffer allocated) | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate(int size) Implements org. Doc from org. Creates a buffer with a given capacity and limit
| |
| hasRemaining | back to summary |
|---|---|
| public boolean hasRemaining() Implements org. Doc from org. Whether there are elements between the current position and the end
| |
| isLastAllocated | back to summary |
|---|---|
| public boolean isLastAllocated(ByteBuffer oldByteBuffer) Implements org. Doc from org. Whether the last element in the buffer has been set
| |
| reallocate | back to summary |
|---|---|
| public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) Implements org. Doc from org. Creates a new Buffer with a set size and assigns it the data that was held in the old one as long as the given size is not smaller than the data held.
| |
| reduceLastAllocated | back to summary |
|---|---|
| public ByteBuffer reduceLastAllocated(ByteBuffer byteBuffer) Implements org. Doc from org. Reduces the buffer to the last data allocated
| |
| release | back to summary |
|---|---|
| public boolean release(ByteBuffer underlyingBuffer) Implements org. Doc from org. deallocates the data in the buffer
| |
| remaining | back to summary |
|---|---|
| public int remaining() Implements org. Doc from org. Gets the number of elements between the current position and the limit
| |
| reset | back to summary |
|---|---|
| public void reset(ByteBuffer pool) Implements org. Doc from org. Resets the Buffer to empty values and empties the pool
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| wantReset | back to summary |
|---|---|
| public boolean wantReset(int size) Implements org. Doc from org. Checks if the size of the Buffer should be reset.
| |
ByteBufferWrapper implementation, which supports trimming. In other words it's possible to return unused
org.glassfish.grizzly.Buffer space to pool.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Overrides org. Implements org. Notify the allocator that the space for this Buffer is no longer needed. |
| public void | |
| protected ByteBufferWrapper | wrapByteBuffer(final ByteBuffer byteBuffer)
Overrides org.
|
| SmallByteBufferWrapper | back to summary |
|---|---|
| private SmallByteBufferWrapper(ByteBuffer underlyingByteBuffer) | |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides org. Implements org. Doc from org. Notify the allocator that the space for this Buffer is no longer needed. All calls to methods on a Buffer will fail after a call to dispose().
| |
| recycle | back to summary |
|---|---|
| public void recycle() Implements org.
| |
| wrapByteBuffer | back to summary |
|---|---|
| protected ByteBufferWrapper wrapByteBuffer(final ByteBuffer byteBuffer) Overrides org.
| |
ByteBufferWrapper implementation, which supports trimming. In other words it's possible to return unused
org.glassfish.grizzly.Buffer space to pool.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Overrides org. Implements org. Notify the allocator that the space for this Buffer is no longer needed. |
| public void | |
| public void | trim()
Overrides org. Implements org. Trim the buffer by reducing capacity to position, if possible. |
| protected ByteBufferWrapper | wrapByteBuffer(ByteBuffer byteBuffer)
Overrides org.
|
| TrimAwareWrapper | back to summary |
|---|---|
| private TrimAwareWrapper(ByteBuffer underlyingByteBuffer) | |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides org. Implements org. Doc from org. Notify the allocator that the space for this Buffer is no longer needed. All calls to methods on a Buffer will fail after a call to dispose().
| |
| recycle | back to summary |
|---|---|
| public void recycle() Implements org.
| |
| trim | back to summary |
|---|---|
| public void trim() Overrides org. Implements org. Doc from org. Trim the buffer by reducing capacity to position, if possible. May return without changing capacity. Also resets the
position to 0, like
| |
| wrapByteBuffer | back to summary |
|---|---|
| protected ByteBufferWrapper wrapByteBuffer(ByteBuffer byteBuffer) Overrides org.
| |