Note that there are some explanatory texts on larger screens.

plurals
  1. POAsserting order of synchronization in Java
    text
    copied!<p>In highly concurrent systems, it can be difficult to be confident that your usage of locks is correct. Specifically, deadlocks can result if locks are acquired in an order that was not expected while being acquired in the proper order in another thread.</p> <p>There are tools (e.g. Coverity) which can do static analysis on a code base and look for "unusual" locking orders. I'd like to explore other options to meet my needs.</p> <p>Are there any light-weight* tools for instrumenting Java code which can detect cases where locks are being acquired in an order other than expected? I am okay with explicitly calling out locking orders via comments / annotations.</p> <p>Free and/or open-source solutions preferred. Please also comment if there are non-instrumentation approaches to this problem.</p> <p>* For my purposes, light-weight means...</p> <ul> <li>If it is instrumentation, I can still run my program with the same <em>ballpark</em> performance. 30-50% degradation is acceptable, I suppose.</li> <li>I don't have to spend half the day interacting with the tool just to get an "okay" out of it. Ideally I should only notice that I'm using it when there's a problem.</li> <li>If it is instrumentation, it should be easy to disable for production environments.</li> <li>It shouldn't clutter my code at every <code>synchronize</code> statement. As previously mentioned, I'm okay with explicitly commenting/annotating the objects or classes of objects which get locked with relative orderings.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload