Package 

Interface RefCounted


  • 
    public interface RefCounted
    
                        

    An interface for reference-counted objects. Can be used with RCPointer by delegation.

    • Method Summary

      Modifier and Type Method Description
      abstract Unit acquire(String source) Acquire a reference.
      abstract Unit release(String source, String reason) Release a reference.
      abstract Integer getRefCount() The current reference count.
      abstract Boolean getIsDisposed() Whether this object has been disposed due to the reference count reaching 0.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • acquire

         abstract Unit acquire(String source)

        Acquire a reference. Must be balanced with a call to release.

        Parameters:
        source - A string indicating the source of the acquisition, for logging purposes, e.g.
      • release

         abstract Unit release(String source, String reason)

        Release a reference. When the last reference is released, the object is disposed.

        Parameters:
        source - A string indicating the source of the acquisition, for logging purposes, e.g.
        reason - An optional string indicating the reason for the release, for logging purposes.
      • getIsDisposed

         abstract Boolean getIsDisposed()

        Whether this object has been disposed due to the reference count reaching 0.