This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes [HELP] thread error!!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "[HELP] thread error!!!!!!!" Watch "[HELP] thread error!!!!!!!" New topic
Author

[HELP] thread error!!!!!!!

Javan Li
Ranch Hand

Joined: Jul 24, 2002
Posts: 84
when i call notifyAll(), come up with a Exception!!!
what's wrong with my code???

java.lang.IllegalMonitorStateException: current thread not owner !!
Snigdha Solanki
Ranch Hand

Joined: Sep 07, 2000
Posts: 128
From where are you calling notifyAll()? Can you post your code?
The error you are getting means that the current thread is not the owner of the object's monitor. Only one thread at a time can own an object's monitor.There are three ways a thread becomes owner of the object's monitor:
� 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.
Hope this helps.


Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: [HELP] thread error!!!!!!!
 
Similar Threads
Thread & Synchronization
Thread and Object
Tech Word Game
subject
WA #1.....word association