org.apache.batik.util
Class HaltingThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.batik.util.HaltingThread
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
GVTTreeBuilder, GVTTreeRenderer, SVGDocumentLoader, SVGLoadEventDispatcher

public class HaltingThread
extends 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
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
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
 
Constructor Summary
HaltingThread()
           
HaltingThread(Runnable r)
           
HaltingThread(Runnable r, String name)
           
HaltingThread(String name)
           
 
Method Summary
 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(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(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, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, 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(Runnable r)

HaltingThread

public HaltingThread(String name)

HaltingThread

public HaltingThread(Runnable r,
                     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(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(Thread t)
Returns the result of calling hasBeenHalted on t, if it is an instance of HaltingThread otherwise it returns false.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.