Package org.apache.batik.util
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: HaltingThread.java 1808001 2017-09-11 09:51:29Z ssteiner $
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Boolean indicating if this thread has ever been 'halted'.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Set's beenHalted to false.void
halt()
Set's beenHalted to true.static void
Calls 'halt' onThread.currentThread()
if it is an instance of HaltingThread otherwise it does nothing.static void
haltThread
(Thread t) Calls 'halt' ont
if it is an instance of HaltingThread otherwise it does nothing.static boolean
Returns the result of calling hasBeenHalted onThread.currentThread()
, if it is an instance of HaltingThread otherwise it returns false.static boolean
Returns the result of calling hasBeenHalted ont
, 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
-
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' ont
if 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.
-