Class DualState.SingleDeleteGlobalRefP<T>

Enclosing class:
DualState<T>

public abstract static class DualState.SingleDeleteGlobalRefP<T> extends DualState.SingleGuardedLong<T>
A DualState subclass whose only native resource releasing action needed is a JNI DeleteGlobalRef of a single pointer.
  • Constructor Details

    • SingleDeleteGlobalRefP

      protected SingleDeleteGlobalRefP(T referent, Lifespan span, long dgrTarget)
  • Method Details

    • formatString

      public String formatString()
      Description copied from class: DualState.SingleGuardedLong
      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.
      Overrides:
      formatString in class DualState.SingleGuardedLong<T>
    • javaStateReleased

      protected void javaStateReleased(boolean nativeStateLive)
      When the Java state is released (it won't normally go unreachable, because of the global ref), a JNI DeleteGlobalRef call is made so the instance can be collected without having to wait for release of its containing context.
      Overrides:
      javaStateReleased in class DualState<T>
      Parameters:
      nativeStateLive - true is passed if the instance's "native state" is still considered live, that is, no lifespan callback has been invoked to stamp it invalid (nor has it been "adopted").
    • nativeStateReleased

      protected void nativeStateReleased(boolean javaStateLive)
      When the native state is released, a JNI DeleteGlobalRef call is made so the global ref stored in that to-be-released memory isn't leaked (left permanently live).
      Overrides:
      nativeStateReleased in class DualState<T>
      Parameters:
      javaStateLive - true is passed if the instance's "Java state" is still considered live, that is, releaseFromJava has not been called, and the garbage collector has not determined the referent to be unreachable.