• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i call notifyAll(), come up with a Exception!!!
what's wrong with my code???

java.lang.IllegalMonitorStateException: current thread not owner !!
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic