grubbelWeblog of Jonas Bonér [jonas AT codehaus DOT org]Use Total Ordering of Objects to Avoid Deadlocks- July 27, 2005 Writing multi-threaded applications in Java can as you know be quite tricky, and if not done correctly, one can easily end up with deadlock situations. For example, take a look at this little code snippet. This piece of Java code implements a Node, which has three methods (that is of our interest): Object get() , void set(Object o) and void swap(Node n) Here's the implementation: public class Node private Object value; public synchronized Object get() ...http://blogs.codehaus.org/people/jboner/archives/001135_use_total_ordering_of_objects_to_a... Semantics for a Synchronized Block Join Point- July 18, 2005 As I mentioned in my previous blog entry, the synchronized block is currently not a supported join point in AspectJ 5 (or in any other AOP framework): Currently you can for example pick out a call to a method that is declared as being synchronized and you can pick out calls to Thread:: notify()notifyAll()wait(). Meaning that being able to pick out synchronized blocks are the only missing piece left in order to completely control thread management and locking in Java. The actual bytecode...http://blogs.codehaus.org/people/jboner/archives/001134_semantics_for_a_synchronized_block... |