| | |
Question about object lock
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2004
Posts: 189
Reputation:
Solved Threads: 0
Hello everyone,
I want to know which method owns the lock of a specific object (some of my methods are blocked because they can not achieve the lock of a specific object, and I am wondering which method owns the lock to solve the deadlock issue). Does anyone know how to get the information?
Thanks in advance,
George
I want to know which method owns the lock of a specific object (some of my methods are blocked because they can not achieve the lock of a specific object, and I am wondering which method owns the lock to solve the deadlock issue). Does anyone know how to get the information?
Thanks in advance,
George
The object that first uses the object in synchronised code owns the lock.
There's no easy way to find out what that is, you'll need to diagnose your code to figure out in what places objects are used in a concurrent way and then figure out a means to deconflict them.
Better of course is to design your code from the start to make deadlock impossible
There's no easy way to find out what that is, you'll need to diagnose your code to figure out in what places objects are used in a concurrent way and then figure out a means to deconflict them.
Better of course is to design your code from the start to make deadlock impossible
•
•
Join Date: Nov 2004
Posts: 189
Reputation:
Solved Threads: 0
Thanks jwenting,
Your reply is very helpful. I think you a very experienced developer from your reply. Can you provide me more detailed skills/tricks dealing with how to find out deadlocks?
regards,
George
•
•
•
•
Originally Posted by jwenting
The object that first uses the object in synchronised code owns the lock.
There's no easy way to find out what that is, you'll need to diagnose your code to figure out in what places objects are used in a concurrent way and then figure out a means to deconflict them.
Better of course is to design your code from the start to make deadlock impossible
regards,
George
![]() |
Similar Threads
- Object creation question (C++)
- DOM Question (JavaScript / DHTML / AJAX)
- asp:repeater in a form? (ASP.NET)
- Linked List & Objects (C++)
Other Threads in the Java Forum
- Previous Thread: Looking for Web proxy in Java
- Next Thread: Shifting Elements in an Array k places to the right.
Views: 4565 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
actuate android api apple applet application arguments array arrays automation balls binary bluetooth business chat class classes client code codesnippet collections component coordinates database defaultmethod doctype dragging draw ebook eclipse educational error event exception file fractal game givemetehcodez graphics gui helpwithhomework hql html ide image ingres input integer invokingapacheantprogrammatically j2me java javaprojects jmf jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie number numbers object oracle parameter php print problem program programming project recursion scanner screen server set size sms socket sort sql string sun swing swt tcp test threads time transfer tree udp windows






