Class Retainable.Wrapper

java.lang.Object
org.eclipse.jetty.io.Retainable.Wrapper
All Implemented Interfaces:
Retainable
Direct Known Subclasses:
RetainableByteBuffer.Abstract, RetainableByteBuffer.Wrapper
Enclosing interface:
Retainable

public static class Retainable.Wrapper extends Object implements Retainable
A wrapper of Retainable instances.
  • Constructor Details

  • Method Details

    • getWrapped

      public Retainable getWrapped()
    • 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.

      Specified by:
      canRetain in interface Retainable
      Returns:
      true if calls to Retainable.retain() are reference counted.
    • getRetained

      public int getRetained()
      Description copied from interface: Retainable

      Get the retained count. This value is volatile and should only be used for informational/debugging purposes.

      Specified by:
      getRetained in interface Retainable
      Returns:
      the retained count
    • isRetained

      public boolean isRetained()
      Description copied from interface: Retainable

      Returns whether Retainable.retain() has been called at least one more time than Retainable.release().

      Specified by:
      isRetained in interface Retainable
      Returns:
      whether this buffer is retained
    • 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 interface Retainable
    • release

      public boolean release()
      Description copied from interface: Retainable

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

      Specified by:
      release in interface Retainable
      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 Object