Package org.eclipse.jetty.io
Class RetainableByteBuffer
java.lang.Object
org.eclipse.jetty.io.RetainableByteBuffer
- All Implemented Interfaces:
Retainable
A Retainable ByteBuffer.
Acquires a ByteBuffer from a ByteBufferPool
and maintains a reference count that is
initially 1, incremented with retain()
and decremented with release()
. The buffer
is released to the pool when the reference count is decremented to 0.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBuffer
private final ByteBufferPool
private final AtomicInteger
-
Constructor Summary
ConstructorsConstructorDescriptionRetainableByteBuffer
(ByteBufferPool pool, int size) RetainableByteBuffer
(ByteBufferPool pool, int size, boolean direct) -
Method Summary
-
Field Details
-
pool
-
buffer
-
references
-
-
Constructor Details
-
RetainableByteBuffer
-
RetainableByteBuffer
-
-
Method Details
-
getBuffer
-
getReferences
public int getReferences() -
retain
public void retain()- Specified by:
retain
in interfaceRetainable
-
release
public int release() -
remaining
public int remaining() -
hasRemaining
public boolean hasRemaining() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
toString
-