java.lang.Object
org.apache.jena.sparql.service.enhancer.claimingcache.RefImpl<T>
All Implemented Interfaces:
AutoCloseable, Ref<T>

public class RefImpl<T> extends Object implements Ref<T>
Implementation of a Ref.
  • Constructor Details

  • Method Details

    • getComment

      public Object getComment()
    • getSynchronizer

      public Object getSynchronizer()
      Description copied from interface: Ref
      Return the object on which reference acquisition, release and the close action are synchronized on.
      Specified by:
      getSynchronizer in interface Ref<T>
    • get

      public T get()
      Description copied from interface: Ref
      Get the referent only iff this ref instance has not yet been closed. This method fails for closed alive refs. A closed reference is alive if it has unclosed child references. For most use cases the referent should be accessed using this method.
      Specified by:
      get in interface Ref<T>
      Returns:
      The referent
    • acquire

      public Ref<T> acquire(Object comment)
      Description copied from interface: Ref
      Acquire a new reference with a given comment object Acquiration fails if isAlive() returns false
      Specified by:
      acquire in interface Ref<T>
    • isAlive

      public boolean isAlive()
      Description copied from interface: Ref
      A reference may itself be closed, but references to it may keep it alive
      Specified by:
      isAlive in interface Ref<T>
      Returns:
      true iff either this reference is not closed or there exists any acquired reference.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Ref<T>
    • fromCloseable

      public static <T extends AutoCloseable> Ref<T> fromCloseable(T value, Object synchronizer)
    • create2

      public static <T> Ref<T> create2(T value, Object synchronizer, Consumer<? super T> closer)
      Create method where the close action is created from a provided lambda that accepts the value
    • create

      public static <T> Ref<T> create(T value, Object synchronizer, AutoCloseable releaseAction)
    • create

      public static <T> Ref<T> create(T value, Object synchronizer, AutoCloseable releaseAction, Object comment)
    • createClosed

      public static <T> Ref<T> createClosed()
    • isClosed

      public boolean isClosed()
      Description copied from interface: Ref
      Check whether this reference is closed
      Specified by:
      isClosed in interface Ref<T>
    • getRootRef

      public Ref<T> getRootRef()
      Description copied from interface: Ref
      Get the root reference
      Specified by:
      getRootRef in interface Ref<T>
    • getAcquisitionStackTrace

      public StackTraceElement[] getAcquisitionStackTrace()
      Description copied from interface: Ref
      Optional operation. References may expose where they were acquired.
      Specified by:
      getAcquisitionStackTrace in interface Ref<T>
    • getCloseStackTrace

      public StackTraceElement[] getCloseStackTrace()
      Description copied from interface: Ref
      Optional operation. References may expose where they were closed was called.
      Specified by:
      getCloseStackTrace in interface Ref<T>
    • getCloseTriggerStackTrace

      public StackTraceElement[] getCloseTriggerStackTrace()
      Description copied from interface: Ref
      Optional operation. References may expose where they were close was triggered upon release.
      Specified by:
      getCloseTriggerStackTrace in interface Ref<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object