nl.justobjects.toolkit.sys
Class ThreadUtil

java.lang.Object
  |
  +--nl.justobjects.toolkit.sys.ThreadUtil

public class ThreadUtil
extends java.lang.Object

Terminates Threads.

Purpose and Responsibilities

In many cases it is hard to stop Threads. Thread.stop() is deprecated and dangerous to use. However in some cases like when a Thread blocks for I/O it is really hard to kill the Trhead. The method terminate() will try to stop a Thread in a sequence of steps, taking more and more hard measures to kill the beast. (a different version will be called Terminator2 :-). Credits: code from "Concurrent Programming in Java 2nd ed" by Doug Lea.

Version:
$Id: ThreadUtil.java,v 1.3 2003/01/06 00:23:49 just Exp $
Author:
Just van den Broecke

Constructor Summary
ThreadUtil()
           
 
Method Summary
static boolean terminate(java.lang.Thread aThread, long aMaxWaitToDieMillis)
          Try to kill a Thread, return true if known to be dead.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

ThreadUtil

public ThreadUtil()
Method Detail

terminate

public static boolean terminate(java.lang.Thread aThread,
                                long aMaxWaitToDieMillis)
Try to kill a Thread, return true if known to be dead.


Copyright © 2000-2001 - Just Objects B.V.