Package org.eclipse.jetty.io
Class AbstractRetainableByteBuffer
java.lang.Object
org.eclipse.jetty.io.AbstractRetainableByteBuffer
- All Implemented Interfaces:
Retainable
,RetainableByteBuffer
Abstract implementation of RetainableByteBuffer
with
reference counting.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Retainable
Retainable.ReferenceCounter
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.RetainableByteBuffer
RetainableByteBuffer.Wrapper
-
Field Summary
Fields inherited from interface org.eclipse.jetty.io.RetainableByteBuffer
EMPTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
acquire()
boolean
Returns whether this resource is referenced counted by calls toRetainable.retain()
andRetainable.release()
.Get the wrapped, notnull
,ByteBuffer
.boolean
boolean
release()
Releases this resource, potentially decrementing a reference count (if any).void
retain()
Retains this resource, potentially incrementing a reference count if there are resources that will be released.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.RetainableByteBuffer
capacity, clear, hasRemaining, isDirect, remaining
-
Constructor Details
-
AbstractRetainableByteBuffer
-
-
Method Details
-
acquire
protected void acquire()- See Also:
-
canRetain
public boolean canRetain()Description copied from interface:Retainable
Returns whether this resource is referenced counted by calls to
Retainable.retain()
andRetainable.release()
.Implementations may decide that special resources are not not referenced counted (for example,
static
constants) so callingRetainable.retain()
is a no-operation, and callingRetainable.release()
on those special resources is a no-operation that always returns true.- Specified by:
canRetain
in interfaceRetainable
- Returns:
- true if calls to
Retainable.retain()
are reference counted.
-
retain
public void retain()Description copied from interface:Retainable
Retains this resource, potentially incrementing a reference count if there are resources that will be released.
- Specified by:
retain
in interfaceRetainable
-
release
public boolean release()Description copied from interface:Retainable
Releases this resource, potentially decrementing a reference count (if any).
- Specified by:
release
in interfaceRetainable
- Returns:
true
when the reference count goes to zero or if there was no reference count,false
otherwise.
-
isRetained
public boolean isRetained()- Specified by:
isRetained
in interfaceRetainableByteBuffer
- Returns:
- whether this instance is retained
- See Also:
-
getByteBuffer
Description copied from interface:RetainableByteBuffer
Get the wrapped, notnull
,ByteBuffer
.- Specified by:
getByteBuffer
in interfaceRetainableByteBuffer
- Returns:
- the wrapped, not
null
,ByteBuffer
-
toString
-