In C#, the lock keyword is nice syntax for a try/catch block and an instance of Monitor.
In Java, what synchronization class is used user the hood of the synchronized keyword?
Edit – I did some further poking – looks like it synchronized gets compiled to monitorenter/monitorexit bytecode ops. Is there a class that duplicated these semantics?
No class is used – it is a language construct handled by the JVM.
However, Java 5 introduced
java.util.concurrent.lockswhere you have theLockinterface and its multiple implementations. See the linked docs for sample usage.