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

public static class ByteBufferChunk.WithReferenceCount extends ByteBufferChunk
  • Constructor Details

    • WithReferenceCount

      public WithReferenceCount(ByteBuffer byteBuffer, boolean last)
  • Method Details

    • canRetain

      public boolean canRetain()
      Description copied from interface: Retainable

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

      Implementations may decide that special resources are not not referenced counted (for example, static constants) so calling Retainable.retain() is a no-operation, and calling Retainable.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

      public String toString()
      Overrides:
      toString in class ByteBufferChunk