Class HaltingThread
java.lang.Object
java.lang.Thread
org.apache.batik.util.HaltingThread
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
GVTTreeBuilder, GVTTreeRenderer, SVGDocumentLoader, SVGLoadEventDispatcher
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.
- Version:
- $Id$
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanBoolean indicating if this thread has ever been 'halted'.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet's beenHalted to false.voidhalt()Set's beenHalted to true.static voidCalls 'halt' onThread.currentThread()if it is an instance of HaltingThread otherwise it does nothing.static voidhaltThread(Thread t) Calls 'halt' ontif it is an instance of HaltingThread otherwise it does nothing.static booleanReturns the result of calling hasBeenHalted onThread.currentThread(), if it is an instance of HaltingThread otherwise it returns false.static booleanReturns 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 Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
beenHalted
protected boolean beenHaltedBoolean indicating if this thread has ever been 'halted'.
-
-
Constructor Details
-
HaltingThread
public HaltingThread() -
HaltingThread
-
HaltingThread
-
HaltingThread
-
-
Method Details
-
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
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
Returns the result of calling hasBeenHalted ont, if it is an instance of HaltingThread otherwise it returns false.
-