Class HaltingThread

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    GVTTreeBuilder, GVTTreeRenderer, SVGDocumentLoader, SVGLoadEventDispatcher

    public class HaltingThread
    extends java.lang.Thread
    This is a subclass of java.lang.Thread that includes a non-intrusive 'halt' method. The Halt method simply sets a boolean that can be checked periodically during expensive processing.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

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

      Fields 
      Modifier and Type Field Description
      protected boolean beenHalted
      Boolean indicating if this thread has ever been 'halted'.
      • 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
      void clearHalted()
      Set's beenHalted to false.
      void halt()
      Set's beenHalted to true.
      static void haltThread()
      Calls 'halt' on Thread.currentThread() if it is an instance of HaltingThread otherwise it does nothing.
      static void haltThread​(java.lang.Thread t)
      Calls 'halt' on t if it is an instance of HaltingThread otherwise it does nothing.
      static boolean hasBeenHalted()
      Returns the result of calling hasBeenHalted on Thread.currentThread(), if it is an instance of HaltingThread otherwise it returns false.
      static boolean hasBeenHalted​(java.lang.Thread t)
      Returns the result of calling hasBeenHalted on t, if it is an instance of HaltingThread otherwise it returns false.
      boolean isHalted()
      returns true if someone has halted the thread.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, 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
    • Field Detail

      • beenHalted

        protected boolean beenHalted
        Boolean indicating if this thread has ever been 'halted'.
    • Constructor Detail

      • HaltingThread

        public HaltingThread()
      • HaltingThread

        public HaltingThread​(java.lang.Runnable r)
      • HaltingThread

        public HaltingThread​(java.lang.String name)
      • HaltingThread

        public HaltingThread​(java.lang.Runnable r,
                             java.lang.String name)
    • Method Detail

      • isHalted

        public boolean isHalted()
        returns true if someone has halted the thread.
      • halt

        public void halt()
        Set's beenHalted to true.
      • clearHalted

        public void clearHalted()
        Set's beenHalted to false.
      • haltThread

        public static void haltThread()
        Calls 'halt' on Thread.currentThread() if it is an instance of HaltingThread otherwise it does nothing.
      • haltThread

        public static void haltThread​(java.lang.Thread t)
        Calls 'halt' on t if it is an instance of HaltingThread otherwise it does nothing.
      • hasBeenHalted

        public static boolean hasBeenHalted()
        Returns the result of calling hasBeenHalted on Thread.currentThread(), if it is an instance of HaltingThread otherwise it returns false.
      • hasBeenHalted

        public static boolean hasBeenHalted​(java.lang.Thread t)
        Returns the result of calling hasBeenHalted on t, if it is an instance of HaltingThread otherwise it returns false.