monitorEnter
Enters the monitor associated with the underlying Java object referred to by obj.
Enters the monitor associated with the object referred to by obj.
Each Java object has a monitor associated with it. If the current thread already owns the monitor associated with obj, it increments a counter in the monitor indicating the number of times this thread has entered the monitor. If the monitor associated with obj is not owned by any thread, the current thread becomes the owner of the monitor, setting the entry count of this monitor to 1. If another thread already owns the monitor associated with obj, the current thread waits until the monitor is released, then tries again to gain ownership.
A monitor entered through a monitorEnter JNI function call cannot be exited using the monitorexit Java virtual machine instruction or a synchronized method return. A monitorEnter JNI function call and a monitorenter Java virtual machine instruction may race to enter the monitor associated with the same object.
To avoid deadlocks, a monitor entered through a monitorEnter JNI function call must be exited using the monitorExit JNI call, unless the JavaVM.detachCurrentThread call is used to implicitly release JNI monitors.