Interrupting a Thread: interrupt()

Chapter 5 - Gracefully Stopping Threads

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Summary
In this chapter, I showed you several ways to temporarily and permanently stop a threads execution. Some of the lessons learned are
  interrupt() can be used to set a threads interrupted status to true and break a thread out of a blocked sleeping or waiting state.
  InterruptedException is thrown to indicate that a thread has noticed that it has been interrupted.
  isInterrupted() can be used at any time on any thread to check whether it has been interrupted, without altering the interrupted status.
  Thread.interrupted() can be used to check whether the current thread has been interrupted, and if so, it automatically resets the interrupted status flag back to false .
  suspend() , resume() , and stop() are deprecated as of JDK 1.2 and should also be avoided in earlier releases.
  Alternative techniques are available to replace the functionality of the deprecated methods .
  Daemon threads automatically stop when all the nondaemon threads have died.

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net