If you have recently been following Project Coin's mailing list, you will have spotted an interesting discussion regarding the inclusion of lock management inside the scope of a try-with-resources (TWR) code block.

The Initial Idea

The idea was initiated by Gernot Neppert who proposed a class java.util.concurrent.AutoLockable which would implement AutoCloseable, and therefore be eligible for usage with TWR.....

Please read further at the java7developer blog post

 

Apologies for the blog jump, but there's lots of code formatting!

Cheers,

Martijn