Modifying SecondCounter to Use Runnable

Chapter 5 - Gracefully Stopping Threads

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Chapter 5: Gracefully Stopping Threads
Overview
In all the examples presented so far in this book, new threads stop running when they die a natural death by returning from the run() method. At times, a thread may be busy doing some involved task for a while (maybe indefinitely) or perhaps may be sleeping for a long time. Sometimes it is necessary to pause or terminate a thread that is executing a lengthy operation whose duration could not be predetermined because of external dependencies like waiting on I/O or for a signal (notification) from another thread. This chapter explores mechanisms used to suspend, resume, and permanently stop a threads execution. This is an area where several methods presented in JDK 1.0 and 1.1 have been deprecated in JDK 1.2. Ill offer alternative techniques to virtually eliminate the necessity to use the deprecated methods .

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