Package org.eclipse.jetty.io.internal
Class ByteBufferChunk.WithReferenceCount
java.lang.Object
org.eclipse.jetty.io.internal.ByteBufferChunk
org.eclipse.jetty.io.internal.ByteBufferChunk.WithReferenceCount
- All Implemented Interfaces:
Content.Chunk
,Retainable
- Direct Known Subclasses:
ByteBufferChunk.ReleasedByConsumer
,ByteBufferChunk.ReleasedByRunnable
- Enclosing class:
- ByteBufferChunk
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.io.internal.ByteBufferChunk
ByteBufferChunk.ReleasedByConsumer, ByteBufferChunk.ReleasedByRunnable, ByteBufferChunk.WithReferenceCount, ByteBufferChunk.WithRetainable
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Content.Chunk
Content.Chunk.Processor
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Retainable
Retainable.ReferenceCounter, Retainable.Wrapper
-
Field Summary
Fields inherited from interface org.eclipse.jetty.io.Content.Chunk
EMPTY, EOF
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this resource is referenced counted by calls toRetainable.retain()
andRetainable.release()
.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 org.eclipse.jetty.io.internal.ByteBufferChunk
getByteBuffer, isLast
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.Content.Chunk
asReadOnly, get, getFailure, hasRemaining, remaining, skip
-
Constructor Details
-
WithReferenceCount
-
-
Method Details
-
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.- 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.
-
release
public boolean release()Description copied from interface:Retainable
Releases this resource, potentially decrementing a reference count (if any).
- Returns:
true
when the reference count goes to zero or if there was no reference count,false
otherwise.
-
toString
- Overrides:
toString
in classByteBufferChunk
-