Class JNIThreadProxy

  • All Implemented Interfaces:
    java.lang.Runnable

    public class JNIThreadProxy
    extends java.lang.Thread
    Proxy for Thread that is called by Ferry native code.

    This class is called from native code to tell if a thread is interrupted. It only exposes the methods that are called from the native code, and adds logging to aid in debugging.

    If allows a global handler to be set. This can be useful for catching threads that are started from native code as there is no other way to detect those and interrupt them. If set, the global handler will always be checked BEFORE the local thread allowing users to always get a callback on each interrupt check if they want.

    Do not change the name or location of this class without also changing the JNIHelper.cpp code that refers to it.

    Since:
    5.0
    Author:
    aclarke
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  JNIThreadProxy.Interruptable
      Interface that global interrupt handlers should use.
      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Thread currentThread()  
      static JNIThreadProxy.Interruptable getGlobalInterruptHandler()
      Gets the current global interrupt handler
      void interrupt()
      boolean isInterrupted()
      static JNIThreadProxy.Interruptable setGlobalInterruptable​(JNIThreadProxy.Interruptable handler)
      Set a new global interrupt handler.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait