Wednesday, October 3, 2012

Nasty Java fun for the day (1)

public class Example {
    public void bang() {
          synchronized("lock") {
              .....

Or synchronizing on getClass().getName() or any other interned string for that matter…

(Apparently jetty [via] has had some deadlock bugs from this anti-pattern)


 ↓ click the "share" button below!