aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes threading problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "threading problem" Watch "threading problem" New topic
Author

threading problem

fadi mujahid
Greenhorn

Joined: Oct 14, 2002
Posts: 28
Hello
I am almost done with my SCJD assignment and I am testing it thoroughly. I am facing the following problem that is occuring randomly:
I am using wait(), notifyAll() for my lock/unlock operations.
Randomly, one of the threads gets stuck in the wait() status and wouldn't gets activated although I call notifyAll at the unlock.
Any suggestion?
Rama Ituarte
Ranch Hand

Joined: Apr 10, 2002
Posts: 62
Are you sure that your unlock is being called, even if an exception occurs?
Rama
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
hi fadi,
instead of catching for specific exceptions try to catch Throwable and print the stacktrace of it to track down things .. am sure something exception is going un noticed in your coded creating these problems.
hope this helps,

cheers,
parthi.


Even crazy and silly looking problems are sometimes real.
fadi mujahid
Greenhorn

Joined: Oct 14, 2002
Posts: 28
Hello
Thank you very much for your help. I finally figured it out: I was wait()ing the object Data, and notifyAll() on object locks!!!
This stupid problem cost me more than 20 hours of debugging.
Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: threading problem
 
Similar Threads
About thread safe...
Is notifyAll good enough?
More than 17 clients CRASH?!
Locking idea for URLYBird
Implementing Lock/Unlock