if a thread might need to be killed from another thread, don't use the stop() method, instead, call interrupt() on it. \ if a thread is sleeping and it receives an interrupt() call, it moves immediately into the Ready state, and when it runs, it will execute its InterruptedException handler.
posted 14 years ago
Sam, Thread.interrupted() Thread.isInterrupted() can be used for testing if a thread was err.. interrupt() Please check the API for the difference between them. If a thread is joining, sleeping or waiting and it is interrupted, it would abandon the state and its "InterruptedException" handler would be executed.