Is it possible to wake up a sleeping thread?

Gautam Marwaha

[I have a thread which is sleeping for a long period of time.Another object has the object of this sleeping thread. In some event , the second object wants to wake up the sleeping thread before its due time for sleeping is completed. I would call it "resuming a sleeping thread". Is this possible or allowed in java?]

Call
sleepingThread.interrupt()

[This will generate an InterruptedException. Now you know why you have to catch InterruptedException every bl**dy time you call Thread.sleep! -Alex]

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact