aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes an exception about thrad Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "an exception about thrad" Watch "an exception about thrad" New topic
Author

an exception about thrad

Paul Sun
Greenhorn

Joined: Aug 26, 2002
Posts: 19
When I use wait(), I get the following exception
java.lang.IllegalMonitorStateException: current thread not owner
Could someone tell me the reason?
Thank you.
Paul
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Paul Sun:
When I use wait(), I get the following exception
java.lang.IllegalMonitorStateException: current thread not owner
Could someone tell me the reason?

You are going to have to put it in a synchronized block or method depending on what you are waiting on... of you are just calling wait() you are really doing this.wait() and that line needs to be in a synchronized method like I said above or in a block like this...

and it will probably need to be in a try-catch to catch InteruptedExceptions.


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: an exception about thrad
 
Similar Threads
what is error?
Server Exception
Struts application design question
void return type in JSP expression
WA #1.....word association