Is there a Mutex in Java?
See this page: http://www.oracle.com/technetwork/articles/javase/index-140767.html It has a slightly different pattern which is (I think) what you are looking for: In this usage, you’re only calling release() after a successful acquire()