Package org.postgresql.pljava.internal
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.SingleFreeErrorData
,DualState.SingleFreeTupleDesc
,DualState.SingleHeapFreeTuple
,DualState.SingleMemContextDelete
,DualState.SinglePfree
,DualState.SingleSPIcursorClose
,DualState.SingleSPIfreeplan
public abstract static class DualState.SingleGuardedLong<T> extends DualState<T>
ADualState
subclass serving only to guard access to a single nonzerolong
value (typically a native pointer).Nothing in particular is done to the native resource at the time of
javaStateReleased
orjavaStateUnreachable
; 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.postgresql.pljava.internal.DualState
DualState.Key, DualState.SingleFreeErrorData<T>, DualState.SingleFreeTupleDesc<T>, DualState.SingleGuardedLong<T>, DualState.SingleHeapFreeTuple<T>, DualState.SingleMemContextDelete<T>, DualState.SinglePfree<T>, DualState.SingleSPIcursorClose<T>, DualState.SingleSPIfreeplan<T>
-
-
Field Summary
-
Fields inherited from class org.postgresql.pljava.internal.DualState
m_resourceOwner
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SingleGuardedLong(DualState.Key cookie, T referent, long resourceOwner, long guardedLong)
-
Method Summary
Modifier and Type Method Description protected String
formatString()
Return aprintf
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.protected long
guardedLong()
String
toString(Object o)
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.-
Methods inherited from class org.postgresql.pljava.internal.DualState
adoptionLock, adoptionUnlock, checkCookie, clear, enqueue, get, identifierForMessage, invalidMessage, invalidSqlState, javaStateReleased, javaStateUnreachable, lock, nativeStateReleased, pin, pinnedByCurrentThread, pinUnlessReleased, referent, releasedMessage, releasedSqlState, releaseFromJava, toString, unlock, unlock, unpin
-
Methods inherited from class java.lang.ref.Reference
clone, isEnqueued, reachabilityFence
-
-
-
-
Constructor Detail
-
SingleGuardedLong
protected SingleGuardedLong(DualState.Key cookie, T referent, long resourceOwner, long guardedLong)
-
-
Method Detail
-
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 classDualState<T>
- Parameters:
o
- An object whose class name (abbreviated by stripping the package prefix) will be used at the start of the string. Passingnull
is the same as passingthis
.- Returns:
- Description of this state object, prefixed with the abbreviated class name of the passed object.
-
formatString
protected String formatString()
Return aprintf
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()
-
-