Package org.apache.batik.util
Class HaltingThread
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.batik.util.HaltingThread
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
GVTTreeBuilder,GVTTreeRenderer,SVGDocumentLoader,SVGLoadEventDispatcher
public class HaltingThread extends java.lang.ThreadThis 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.- Version:
- $Id: HaltingThread.java 1808001 2017-09-11 09:51:29Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbeenHaltedBoolean indicating if this thread has ever been 'halted'.
-
Constructor Summary
Constructors Constructor Description HaltingThread()HaltingThread(java.lang.Runnable r)HaltingThread(java.lang.Runnable r, java.lang.String name)HaltingThread(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearHalted()Set's beenHalted to false.voidhalt()Set's beenHalted to true.static voidhaltThread()Calls 'halt' onThread.currentThread()if it is an instance of HaltingThread otherwise it does nothing.static voidhaltThread(java.lang.Thread t)Calls 'halt' ontif it is an instance of HaltingThread otherwise it does nothing.static booleanhasBeenHalted()Returns the result of calling hasBeenHalted onThread.currentThread(), if it is an instance of HaltingThread otherwise it returns false.static booleanhasBeenHalted(java.lang.Thread t)Returns the result of calling hasBeenHalted ont, if it is an instance of HaltingThread otherwise it returns false.booleanisHalted()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
-
-
-
-
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' onThread.currentThread()if it is an instance of HaltingThread otherwise it does nothing.
-
haltThread
public static void haltThread(java.lang.Thread t)
Calls 'halt' ontif it is an instance of HaltingThread otherwise it does nothing.
-
hasBeenHalted
public static boolean hasBeenHalted()
Returns the result of calling hasBeenHalted onThread.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 ont, if it is an instance of HaltingThread otherwise it returns false.
-
-