-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6-pool
-
generic
-
generic
I really appreciate the tutorials but this Deadlock example was very confusing.
http://download.oracle.com/javase/tutorial/essential/concurrency/deadlock.html
I (with a few years java experience but new to concurrency) spent several hours trying to figure out why the deadlock happened, and it took two senior java developers working together for 10-20 minutes to figure it out and they agreed it was a silly and confusing example.
My assumption was that the two threads were trying to access the same Friend object in memory, but if that were the case how would the second thread get into the bow method. The way it was finally explained to me is that each thread had it’s own Friend object with a lock on it and was trying to access the other threads Friend object thus causing the deadlock. I’m not even sure that’s right but it seems to make sense.
The example needs much more explanation as it currently basically just rewords the problem setup. It should walk through what each thread is doing, what exactly is being locked and when. Something more along the lines of the bottom of this page: http://download.oracle.com/javase/tutorial/essential/concurrency/interfere.html.
http://download.oracle.com/javase/tutorial/essential/concurrency/deadlock.html
I (with a few years java experience but new to concurrency) spent several hours trying to figure out why the deadlock happened, and it took two senior java developers working together for 10-20 minutes to figure it out and they agreed it was a silly and confusing example.
My assumption was that the two threads were trying to access the same Friend object in memory, but if that were the case how would the second thread get into the bow method. The way it was finally explained to me is that each thread had it’s own Friend object with a lock on it and was trying to access the other threads Friend object thus causing the deadlock. I’m not even sure that’s right but it seems to make sense.
The example needs much more explanation as it currently basically just rewords the problem setup. It should walk through what each thread is doing, what exactly is being locked and when. Something more along the lines of the bottom of this page: http://download.oracle.com/javase/tutorial/essential/concurrency/interfere.html.