Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Techguy Sr eng.   on May 03 In Java Category.

  
Question Answered By: Kelly Bell   on May 03

wait(), notify() and notifyAll() should be called only if the current thread  is
the owner of the object, else it throws illigalmonitorstate exception

check out the java  API for wait  notify and notifyall in the object  class.


This method should only be called by a thread that is the owner of this object's
monitor. A thread becomes the owner of the object's monitor in one of three
ways:
By executing a synchronized instance method of that object.
By executing the body of a synchronized statement that synchronizes on the
object.
For objects of type Class, by executing a synchronized static method of that
class.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Threading Syncronization Or get search suggestion and latest updates.