org.apache.batik.util

Class HaltingThread

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.
Field Summary
protected booleanbeenHalted
Boolean indicating if this thread has ever been 'halted'.
Constructor Summary
HaltingThread()
HaltingThread(Runnable r)
HaltingThread(String name)
HaltingThread(Runnable r, String name)
Method Summary
voidclearHalted()
Set's beenHalted to false.
voidhalt()
Set's beenHalted to true.
static voidhaltThread()
Calls 'halt' on Thread.currentThread() if it is an instance of HaltingThread otherwise it does nothing.
static voidhaltThread(Thread t)
Calls 'halt' on t if it is an instance of HaltingThread otherwise it does nothing.
static booleanhasBeenHalted()
Returns the result of calling hasBeenHalted on Thread.currentThread(), if it is an instance of HaltingThread otherwise it returns false.
static booleanhasBeenHalted(Thread t)
Returns the result of calling hasBeenHalted on t, if it is an instance of HaltingThread otherwise it returns false.
booleanisHalted()
returns true if someone has halted the thread.

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

clearHalted

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

halt

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

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.

isHalted

public boolean isHalted()
returns true if someone has halted the thread.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.