All Packages Class Hierarchy This Package Previous Next Index
Class Acme.TimeKiller
java.lang.Object
|
+----Acme.TimeKiller
- public class TimeKiller
- extends Object
- implements Runnable
Kill a thread after a given timeout has elapsed
A simple timeout class. You give it a thread to watch and a timeout
in milliseconds. After the timeout has elapsed, the thread is killed
with a Thread.stop(). If the thread finishes successfully before then,
you can cancel the timeout with a done() call; you can also re-use the
timeout on the same thread with the reset() call.
Fetch the software.
Fetch the entire Acme package.
-
TimeKiller(long)
- Constructor, current thread.
-
TimeKiller(Thread, long)
- Constructor.
-
done()
- Call this when the target thread has finished.
-
reset()
- Call this to restart the wait from zero.
-
reset(long)
- Call this to restart the wait from zero with a different timeout value.
-
run()
- The watcher thread - from the Runnable interface.
TimeKiller
public TimeKiller(Thread targetThread,
long millis)
- Constructor. Give it a thread to watch, and a timeout in milliseconds.
After the timeout has elapsed, the thread gets killed. If you want
to cancel the kill, just call done().
TimeKiller
public TimeKiller(long millis)
- Constructor, current thread.
done
public synchronized void done()
- Call this when the target thread has finished.
reset
public synchronized void reset()
- Call this to restart the wait from zero.
reset
public synchronized void reset(long millis)
- Call this to restart the wait from zero with a different timeout value.
run
public synchronized void run()
- The watcher thread - from the Runnable interface.
This has to be pretty anal to avoid monitor lockup, lost
threads, etc.
All Packages Class Hierarchy This Package Previous Next Index
ACME Java ACME Labs