How can I determine if a wait(timeout) timed out or was notify()'ed? I'm thinking of the case where multiple threads are waiting and notifyAll() is NOT used.

Jim Nelson

According to Allen Holub's article on IBM.com, there is no way to be sure that a wait(timeout) timed out rather than was notify'd. He suggests a simple change: that wait return a boolean value indicating if it timed out.

This excellent article mentions several other changes he'd like to see in Java's threading model and is a good read for anyone doing heavy Java threaded programming.

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

 

 

 

 

 


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

 

 

About | Sitemap | Contact