Top Description Fields Constructors Methods
org.eclipse.jetty.io

public abstract Class AbstractRetainableByteBuffer

extends Object
implements RetainableByteBuffer
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.RetainableByteBuffer, org.eclipse.jetty.io.Retainable
Known Direct Subclasses
org.eclipse.jetty.io.ArrayByteBufferPool.Buffer, org.eclipse.jetty.io.ByteBufferPool.NonPooling.Buffer
Imports
java.nio.ByteBuffer, java.util.Objects, org.eclipse.jetty.util.BufferUtil

Abstract implementation of RetainableByteBuffer with reference counting.

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private final Retainable.ReferenceCounter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public boolean
canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

public ByteBuffer
getByteBuffer()

Implements org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer.

Get the wrapped, not null, ByteBuffer.
public boolean
public boolean
release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

public void
retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

byteBufferback to summary
private final ByteBuffer byteBuffer
refCountback to summary
private final Retainable.ReferenceCounter refCount

Constructor Detail

AbstractRetainableByteBufferback to summary
public AbstractRetainableByteBuffer(ByteBuffer byteBuffer)

Method Detail

acquireback to summary
protected void acquire()
See Also
ReferenceCounter#acquire()
canRetainback to summary
public boolean canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Doc from org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

Implementations may decide that special resources are not not referenced counted (for example, static constants) so calling retain() is a no-operation, and calling release() on those special resources is a no-operation that always returns true.

Returns:boolean

true if calls to retain() are reference counted.

Annotations
@Override
getByteBufferback to summary
public ByteBuffer getByteBuffer()

Implements org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer.

Doc from org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer.

Get the wrapped, not null, ByteBuffer.

Returns:ByteBuffer

the wrapped, not null, ByteBuffer

Annotations
@Override
isRetainedback to summary
public boolean isRetained()

Implements org.eclipse.jetty.io.RetainableByteBuffer.isRetained.

Returns:boolean

Doc from org.eclipse.jetty.io.RetainableByteBuffer.isRetained.

whether this instance is retained

Annotations
@Override
releaseback to summary
public boolean release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Doc from org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

Returns:boolean

true when the reference count goes to zero or if there was no reference count, false otherwise.

Annotations
@Override
retainback to summary
public void retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Doc from org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

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.

Returns:String

a string representation of the object.

Annotations
@Override