Class DualState.SingleGuardedLong<T>

java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.WeakReference<T>
org.postgresql.pljava.internal.DualState<T>
org.postgresql.pljava.internal.DualState.SingleGuardedLong<T>
Direct Known Subclasses:
DualState.SingleDeleteGlobalRefP, DualState.SingleFreeErrorData, DualState.SingleFreeTupleDesc, DualState.SingleHeapFreeTuple, DualState.SinglePfree, DualState.SingleSPIcursorClose, DualState.SingleSPIfreeplan, DualState.SingleSPIfreetuptable
Enclosing class:
DualState<T>

public abstract static class DualState.SingleGuardedLong<T> extends DualState<T>
A DualState subclass serving only to guard access to a single nonzero long value (typically a native pointer).

Nothing in particular is done to the native resource at the time of javaStateReleased or javaStateUnreachable; if it is subject to reclamation, this class assumes it will be shortly, in the normal operation of the native code. This can be appropriate for native state that was set up by a native caller for a short lifetime, such as a single function invocation.

  • Constructor Details

    • SingleGuardedLong

      protected SingleGuardedLong(T referent, Lifespan span, long guardedLong)
  • Method Details

    • toString

      public String toString(Object o)
      Description copied from class: DualState
      Produce a string with such details of this object as might be useful for debugging, starting with an abbreviated form of the class name of the supplied object.

      Subclasses are encouraged to override this and then call it, via super, passing the object unchanged, and then append additional subclass-specific details to the result.

      Because the recursion ends here, this one actually does construct the abbreviated form of the class name of the object, and use it at the start of the returned string.

      Overrides:
      toString in class DualState<T>
      Parameters:
      o - An object whose class name (abbreviated by stripping the package prefix) will be used at the start of the string. Passing null is the same as passing this.
      Returns:
      Description of this state object, prefixed with the abbreviated class name of the passed object.
    • formatString

      protected String formatString()
      Return a printf format string resembling "%s something(%x)" where the %x will be the value being guarded; the "something" should indicate what the value represents, or what will be done with it when released by Java.
    • guardedLong

      protected final long guardedLong()