wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Waking up a sleeping thread? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Waking up a sleeping thread?" Watch "Waking up a sleeping thread?" New topic
Author

Waking up a sleeping thread?

huny chopra
Greenhorn

Joined: Sep 17, 2007
Posts: 2
Can we wake up a sleeping thread before its sleeping time elapses?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, welcome to the ranch!

The Thread sleep() doc gives a good hint ... it can throw an interrupted exception if another thread interrupts it. That's what you need. Let's say MyRunnable sleeps at some point and we want to wake it up:

See if you can make something like that run. Let us know how it goes!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Waking up a sleeping thread?