![]() |
The Java Developers Almanac 1.4 |
|
e95. Pausing the Current ThreadThis example demonstrates how a thread can temporarily stop execution.See also e96 Pausing a Thread try {
long numMillisecondsToSleep = 5000; // 5 seconds
Thread.sleep(numMillisecondsToSleep);
} catch (InterruptedException e) {
}
e93. Stopping a Thread e94. Determining When a Thread Has Finished e96. Pausing a Thread e97. Determining If the Current Thread Is Holding a Synchronized Lock e98. Allowing an Application with Live Threads to Exit e99. Listing All Running Threads e100. Using a Thread-Local Variable e101. Getting the Stack Trace of an Exception e102. Implementing a Work Queue
© 2002 Addison-Wesley. |