Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.memory

public Class ByteBufferManager

extends AbstractMemoryManager<ByteBufferWrapper>
implements WrapperAware, ByteBufferAware
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.memory.ByteBufferAware, org.glassfish.grizzly.memory.WrapperAware
Imports
java.io.UnsupportedEncodingException, java.nio.ByteBuffer, java.nio.charset.Charset, java.util.Arrays, org.glassfish.grizzly.Cacheable, .ThreadCache, org.glassfish.grizzly.monitoring.MonitoringConfig, .MonitoringUtils

The simple Buffer manager implementation, which works as wrapper above ByteBuffers. It's possible to work either with direct or heap ByteBuffers.
Authors
Jean-Francois Arcand, Alexey Stashok
See Also
MemoryManager, ByteBuffer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ByteBufferManager.ByteBufferThreadLocalPool

Information about thread associated memory pool.

protected class
ByteBufferManager.SmallByteBufferWrapper

ByteBufferWrapper implementation, which supports trimming.

private class
ByteBufferManager.TrimAwareWrapper

ByteBufferWrapper implementation, which supports trimming.

Field Summary

Modifier and TypeField and Description
private static final ThreadCache.CachedTypeIndex<ByteBufferManager.TrimAwareWrapper>
public static final int
protected boolean
isDirect

Is direct ByteBuffer should be used?

protected final int
private final ThreadCache.CachedTypeIndex<ByteBufferManager.SmallByteBufferWrapper>
Inherited from org.glassfish.grizzly.memory.AbstractMemoryManager:
DEFAULT_MAX_BUFFER_SIZEmaxBufferSizemonitoringConfig

Constructor Summary

AccessConstructor and Description
public
public
ByteBufferManager(final boolean isDirect)

public
ByteBufferManager(final boolean isDirect, final int maxBufferSize, final int maxSmallBufferSize)

Method Summary

Modifier and TypeMethod and Description
public ByteBufferWrapper
allocate(final int size)

Implements org.glassfish.grizzly.memory.MemoryManager.allocate.

Allocated Buffer of the required size.

public ByteBufferWrapper
allocateAtLeast(int size)

Implements org.glassfish.grizzly.memory.MemoryManager.allocateAtLeast.

Allocated Buffer at least of the provided size.

public ByteBuffer

Returns:

allocated ByteBuffer.
allocateByteBuffer
(final int size)

Implements org.glassfish.grizzly.memory.ByteBufferAware.allocateByteBuffer.

Allocates ByteBuffer of required size.

protected final ByteBuffer
allocateByteBuffer0(final int size)

public ByteBuffer

Returns:

allocated ByteBuffer.
allocateByteBufferAtLeast
(final int size)

Implements org.glassfish.grizzly.memory.ByteBufferAware.allocateByteBufferAtLeast.

Allocates ByteBuffer of required size.

protected Object

Returns:

the Memory Manager JMX management object.
createJmxManagementObject
()

Implements abstract org.glassfish.grizzly.memory.AbstractMemoryManager.createJmxManagementObject.

Create the Memory Manager JMX management object.

protected ByteBufferManager.SmallByteBufferWrapper
public ThreadLocalPool<E>
private ByteBufferManager.TrimAwareWrapper
createTrimAwareBuffer(final ByteBuffer underlyingByteBuffer)

private static ByteBufferManager.ByteBufferThreadLocalPool
public int
public MonitoringConfig<MemoryProbe>
public boolean

Returns:

true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.
isDirect
()

Returns true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

public ByteBufferWrapper
reallocate(ByteBufferWrapper oldBuffer, int newSize)

Implements org.glassfish.grizzly.memory.MemoryManager.reallocate.

Reallocate Buffer to a required size.

public ByteBuffer
private void
public void
release(ByteBufferWrapper buffer)

Implements org.glassfish.grizzly.memory.MemoryManager.release.

Lets JVM Garbage collector to release buffer.

public void
public void
setDirect(boolean
true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.
isDirect
)

Set true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

public boolean
willAllocateDirect(int size)

Implements org.glassfish.grizzly.memory.MemoryManager.willAllocateDirect.

Return true if next allocate(int) or allocateAtLeast(int) call, made in the current thread for the given memory size, going to return a Buffer based on direct java.nio.ByteBuffer, or false otherwise.

public ByteBufferWrapper
wrap(byte[] data)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the byte array.

public ByteBufferWrapper
wrap(byte[] data, int offset, int length)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the part of byte array with specific offset and length.

public ByteBufferWrapper
public ByteBufferWrapper
wrap(String s, Charset charset)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the String with the specific Charset.

public ByteBufferWrapper
wrap(final ByteBuffer byteBuffer)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the ByteBuffer.

Inherited from org.glassfish.grizzly.memory.AbstractMemoryManager:
allocateFromPoolgetMaxBufferSizegetReadyThreadBufferSizegetThreadLocalPool

Field Detail

CACHE_IDXback to summary
private static final ThreadCache.CachedTypeIndex<ByteBufferManager.TrimAwareWrapper> CACHE_IDX
DEFAULT_SMALL_BUFFER_SIZEback to summary
public static final int DEFAULT_SMALL_BUFFER_SIZE

Todo

Document

isDirectback to summary
protected boolean isDirect

Is direct ByteBuffer should be used?

maxSmallBufferSizeback to summary
protected final int maxSmallBufferSize
SMALL_BUFFER_CACHE_IDXback to summary
private final ThreadCache.CachedTypeIndex<ByteBufferManager.SmallByteBufferWrapper> SMALL_BUFFER_CACHE_IDX

Constructor Detail

ByteBufferManagerback to summary
public ByteBufferManager()
ByteBufferManagerback to summary
public ByteBufferManager(final boolean isDirect)
ByteBufferManagerback to summary
public ByteBufferManager(final boolean isDirect, final int maxBufferSize, final int maxSmallBufferSize)

Method Detail

allocateback to summary
public ByteBufferWrapper allocate(final int size)

Implements org.glassfish.grizzly.memory.MemoryManager.allocate.

Doc from org.glassfish.grizzly.memory.MemoryManager.allocate.

Allocated Buffer of the required size.

Annotations
@Override
allocateAtLeastback to summary
public ByteBufferWrapper allocateAtLeast(int size)

Implements org.glassfish.grizzly.memory.MemoryManager.allocateAtLeast.

Doc from org.glassfish.grizzly.memory.MemoryManager.allocateAtLeast.

Allocated Buffer at least of the provided size. This could be useful for usecases like Socket.read(...), where we're not sure how many bytes are available, but want to read as much as possible.

Annotations
@Override
allocateByteBufferback to summary
public ByteBuffer allocateByteBuffer(final int size)

Implements org.glassfish.grizzly.memory.ByteBufferAware.allocateByteBuffer.

Allocates ByteBuffer of required size.

Parameters
size:int

ByteBuffer size.

Returns:ByteBuffer

allocated ByteBuffer.

Annotations
@Override
@SuppressWarnings:unchecked
allocateByteBuffer0back to summary
protected final ByteBuffer allocateByteBuffer0(final int size)
allocateByteBufferAtLeastback to summary
public ByteBuffer allocateByteBufferAtLeast(final int size)

Implements org.glassfish.grizzly.memory.ByteBufferAware.allocateByteBufferAtLeast.

Allocates ByteBuffer of required size.

Parameters
size:int

ByteBuffer size.

Returns:ByteBuffer

allocated ByteBuffer.

Annotations
@Override
@SuppressWarnings:unchecked
createJmxManagementObjectback to summary
protected Object createJmxManagementObject()

Implements abstract org.glassfish.grizzly.memory.AbstractMemoryManager.createJmxManagementObject.

Create the Memory Manager JMX management object.

Returns:Object

the Memory Manager JMX management object.

Annotations
@Override
createSmallBufferback to summary
protected ByteBufferManager.SmallByteBufferWrapper createSmallBuffer()
createThreadLocalPoolback to summary
public ThreadLocalPool<E> createThreadLocalPool()

Implements org.glassfish.grizzly.memory.ThreadLocalPoolProvider.createThreadLocalPool.

Annotations
@Override
createTrimAwareBufferback to summary
private ByteBufferManager.TrimAwareWrapper createTrimAwareBuffer(final ByteBuffer underlyingByteBuffer)
getByteBufferThreadLocalPoolback to summary
private static ByteBufferManager.ByteBufferThreadLocalPool getByteBufferThreadLocalPool()
Annotations
@SuppressWarnings:unchecked
getMaxSmallBufferSizeback to summary
public int getMaxSmallBufferSize()
getMonitoringConfigback to summary
public MonitoringConfig<MemoryProbe> getMonitoringConfig()

Implements org.glassfish.grizzly.monitoring.MonitoringAware.getMonitoringConfig.

Doc from org.glassfish.grizzly.monitoring.MonitoringAware.getMonitoringConfig.

Return the object associated MonitoringConfig.

Annotations
@Override
isDirectback to summary
public boolean isDirect()

Returns true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

Returns:boolean

true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

reallocateback to summary
public ByteBufferWrapper reallocate(ByteBufferWrapper oldBuffer, int newSize)

Implements org.glassfish.grizzly.memory.MemoryManager.reallocate.

Doc from org.glassfish.grizzly.memory.MemoryManager.reallocate.

Reallocate Buffer to a required size. Implementation may choose the way, how reallocation could be done, either by allocating new Buffer of required size and copying old Buffer content there, or perform more complex logic related to memory pooling etc.

Annotations
@Override
reallocateByteBufferback to summary
public ByteBuffer reallocateByteBuffer(ByteBuffer oldByteBuffer, int newSize)

Implements org.glassfish.grizzly.memory.ByteBufferAware.reallocateByteBuffer.

Annotations
@Override
@SuppressWarnings:unchecked
reallocatePoolBufferback to summary
private void reallocatePoolBuffer()
Annotations
@SuppressWarnings:unchecked
releaseback to summary
public void release(ByteBufferWrapper buffer)

Implements org.glassfish.grizzly.memory.MemoryManager.release.

Lets JVM Garbage collector to release buffer.

Annotations
@Override
releaseByteBufferback to summary
public void releaseByteBuffer(ByteBuffer byteBuffer)

Implements org.glassfish.grizzly.memory.ByteBufferAware.releaseByteBuffer.

Annotations
@Override
@SuppressWarnings:unchecked
setDirectback to summary
public void setDirect(boolean isDirect)

Set true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

Parameters
isDirect:boolean

true, if ByteBufferManager works with direct ByteBuffers, or false otherwise.

willAllocateDirectback to summary
public boolean willAllocateDirect(int size)

Implements org.glassfish.grizzly.memory.MemoryManager.willAllocateDirect.

Doc from org.glassfish.grizzly.memory.MemoryManager.willAllocateDirect.

Return true if next allocate(int) or allocateAtLeast(int) call, made in the current thread for the given memory size, going to return a Buffer based on direct java.nio.ByteBuffer, or false otherwise.

Annotations
@Override
wrapback to summary
public ByteBufferWrapper wrap(byte[] data)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Doc from org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the byte array.

Annotations
@Override
wrapback to summary
public ByteBufferWrapper wrap(byte[] data, int offset, int length)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Doc from org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the part of byte array with specific offset and length.

Annotations
@Override
wrapback to summary
public ByteBufferWrapper wrap(String s)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Doc from org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the String.

Annotations
@Override
wrapback to summary
public ByteBufferWrapper wrap(String s, Charset charset)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Doc from org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the String with the specific Charset.

Annotations
@Override
wrapback to summary
public ByteBufferWrapper wrap(final ByteBuffer byteBuffer)

Implements org.glassfish.grizzly.memory.WrapperAware.wrap.

Doc from org.glassfish.grizzly.memory.WrapperAware.wrap.

Returns Buffer, which wraps the ByteBuffer.

Annotations
@Override
org.glassfish.grizzly.memory back to summary

private final Class ByteBufferManager.ByteBufferThreadLocalPool

extends Object
implements ThreadLocalPool<ByteBuffer>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.memory.ByteBufferManager.ByteBufferThreadLocalPool
All Implemented Interfaces
org.glassfish.grizzly.memory.ThreadLocalPool

Information about thread associated memory pool.

Field Summary

Modifier and TypeField and Description
private Object[]
allocationHistory

ByteBuffer allocation history.

private int
private ByteBuffer
pool

Memory pool

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private ByteBuffer
public ByteBuffer
allocate(int size)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.allocate.

Creates a buffer with a given capacity and limit

public boolean
hasRemaining()

Implements org.glassfish.grizzly.memory.ThreadLocalPool.hasRemaining.

Whether there are elements between the current position and the end

public boolean
isLastAllocated(ByteBuffer oldByteBuffer)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.isLastAllocated.

Whether the last element in the buffer has been set

public ByteBuffer
reallocate(ByteBuffer oldByteBuffer, int newSize)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.reallocate.

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.glassfish.grizzly.memory.ThreadLocalPool.reduceLastAllocated.

Reduces the buffer to the last data allocated

public boolean
release(ByteBuffer underlyingBuffer)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.release.

deallocates the data in the buffer

public int
remaining()

Implements org.glassfish.grizzly.memory.ThreadLocalPool.remaining.

Gets the number of elements between the current position and the limit

public void
reset(ByteBuffer pool)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.reset.

Resets the Buffer to empty values and empties the pool

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
wantReset(int size)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.wantReset.

Checks if the size of the Buffer should be reset.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

allocationHistoryback to summary
private Object[] allocationHistory

ByteBuffer allocation history.

lastAllocatedIndexback to summary
private int lastAllocatedIndex
poolback to summary
private ByteBuffer pool

Memory pool

Constructor Detail

ByteBufferThreadLocalPoolback to summary
public ByteBufferThreadLocalPool()

Method Detail

addHistoryback to summary
private ByteBuffer addHistory(ByteBuffer allocated)
allocateback to summary
public ByteBuffer allocate(int size)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.allocate.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.allocate.

Creates a buffer with a given capacity and limit

Annotations
@Override
hasRemainingback to summary
public boolean hasRemaining()

Implements org.glassfish.grizzly.memory.ThreadLocalPool.hasRemaining.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.hasRemaining.

Whether there are elements between the current position and the end

Annotations
@Override
isLastAllocatedback to summary
public boolean isLastAllocated(ByteBuffer oldByteBuffer)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.isLastAllocated.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.isLastAllocated.

Whether the last element in the buffer has been set

Annotations
@Override
reallocateback to summary
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.reallocate.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.reallocate.

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.

Annotations
@Override
reduceLastAllocatedback to summary
public ByteBuffer reduceLastAllocated(ByteBuffer byteBuffer)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.reduceLastAllocated.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.reduceLastAllocated.

Reduces the buffer to the last data allocated

Annotations
@Override
releaseback to summary
public boolean release(ByteBuffer underlyingBuffer)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.release.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.release.

deallocates the data in the buffer

Annotations
@Override
remainingback to summary
public int remaining()

Implements org.glassfish.grizzly.memory.ThreadLocalPool.remaining.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.remaining.

Gets the number of elements between the current position and the limit

Annotations
@Override
resetback to summary
public void reset(ByteBuffer pool)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.reset.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.reset.

Resets the Buffer to empty values and empties the pool

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
wantResetback to summary
public boolean wantReset(int size)

Implements org.glassfish.grizzly.memory.ThreadLocalPool.wantReset.

Doc from org.glassfish.grizzly.memory.ThreadLocalPool.wantReset.

Checks if the size of the Buffer should be reset.

Annotations
@Override
org.glassfish.grizzly.memory back to summary

protected final Class ByteBufferManager.SmallByteBufferWrapper

extends ByteBufferWrapper
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Cacheable

ByteBufferWrapper implementation, which supports trimming. In other words it's possible to return unused org.glassfish.grizzly.Buffer space to pool.

Field Summary

Inherited from org.glassfish.grizzly.memory.ByteBufferWrapper:
allowBufferDisposeDEBUG_MODEdisposeStackTracemarkvisible

Constructor Summary

AccessConstructor and Description
private
SmallByteBufferWrapper(ByteBuffer underlyingByteBuffer)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.dispose.

Implements org.glassfish.grizzly.Buffer.dispose.

Notify the allocator that the space for this Buffer is no longer needed.

public void
protected ByteBufferWrapper
Inherited from org.glassfish.grizzly.memory.ByteBufferWrapper:
allowBufferDisposeallowBufferDisposearrayarrayOffsetasReadOnlyBuffercapacitycheckDisposeclearcompactcompareTodumpHexduplicateequalsflipgetgetgetgetgetgetgetChargetChargetDoublegetDoublegetFloatgetFloatgetIntgetIntgetLonggetLonggetShortgetShorthasArrayhashCodehasRemainingisCompositeisDirectisExternalisReadOnlylimitlimitmarkorderorderpositionpositionprepareDisposeprependputputputputputputputputput8BitStringputCharputCharputDoubleputDoubleputFloatputFloatputIntputIntputLongputLongputShortputShortreleaseremainingresetrewindshrinksliceslicesplittoBufferArraytoBufferArraytoBufferArraytoBufferArraytoByteBuffertoByteBuffertoByteBufferArraytoByteBufferArraytoByteBufferArraytoByteBufferArraytoStringtoStringContenttoStringContenttoStringContenttrimtryDisposeunderlying

Constructor Detail

SmallByteBufferWrapperback to summary
private SmallByteBufferWrapper(ByteBuffer underlyingByteBuffer)

Method Detail

disposeback to summary
public void dispose()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.dispose.

Implements org.glassfish.grizzly.Buffer.dispose.

Doc from org.glassfish.grizzly.Buffer.dispose.

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().

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
wrapByteBufferback to summary
protected ByteBufferWrapper wrapByteBuffer(final ByteBuffer byteBuffer)

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.wrapByteBuffer.

Annotations
@Override
org.glassfish.grizzly.memory back to summary

private final Class ByteBufferManager.TrimAwareWrapper

extends ByteBufferWrapper
implements TrimAware
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.memory.AbstractMemoryManager.TrimAware, org.glassfish.grizzly.Cacheable

ByteBufferWrapper implementation, which supports trimming. In other words it's possible to return unused org.glassfish.grizzly.Buffer space to pool.

Field Summary

Inherited from org.glassfish.grizzly.memory.ByteBufferWrapper:
allowBufferDisposeDEBUG_MODEdisposeStackTracemarkvisible

Constructor Summary

AccessConstructor and Description
private
TrimAwareWrapper(ByteBuffer underlyingByteBuffer)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.dispose.

Implements org.glassfish.grizzly.Buffer.dispose.

Notify the allocator that the space for this Buffer is no longer needed.

public void
public void
trim()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.trim.

Implements org.glassfish.grizzly.Buffer.trim.

Trim the buffer by reducing capacity to position, if possible.

protected ByteBufferWrapper
Inherited from org.glassfish.grizzly.memory.ByteBufferWrapper:
allowBufferDisposeallowBufferDisposearrayarrayOffsetasReadOnlyBuffercapacitycheckDisposeclearcompactcompareTodumpHexduplicateequalsflipgetgetgetgetgetgetgetChargetChargetDoublegetDoublegetFloatgetFloatgetIntgetIntgetLonggetLonggetShortgetShorthasArrayhashCodehasRemainingisCompositeisDirectisExternalisReadOnlylimitlimitmarkorderorderpositionpositionprepareDisposeprependputputputputputputputputput8BitStringputCharputCharputDoubleputDoubleputFloatputFloatputIntputIntputLongputLongputShortputShortreleaseremainingresetrewindshrinksliceslicesplittoBufferArraytoBufferArraytoBufferArraytoBufferArraytoByteBuffertoByteBuffertoByteBufferArraytoByteBufferArraytoByteBufferArraytoByteBufferArraytoStringtoStringContenttoStringContenttoStringContenttryDisposeunderlying

Constructor Detail

TrimAwareWrapperback to summary
private TrimAwareWrapper(ByteBuffer underlyingByteBuffer)

Method Detail

disposeback to summary
public void dispose()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.dispose.

Implements org.glassfish.grizzly.Buffer.dispose.

Doc from org.glassfish.grizzly.Buffer.dispose.

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().

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
trimback to summary
public void trim()

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.trim.

Implements org.glassfish.grizzly.Buffer.trim.

Doc from org.glassfish.grizzly.Buffer.trim.

Trim the buffer by reducing capacity to position, if possible. May return without changing capacity. Also resets the position to 0, like flip().

Annotations
@Override
@SuppressWarnings:unchecked
wrapByteBufferback to summary
protected ByteBufferWrapper wrapByteBuffer(ByteBuffer byteBuffer)

Overrides org.glassfish.grizzly.memory.ByteBufferWrapper.wrapByteBuffer.

Annotations
@Override