lets say Thread-1 synchronizes on object
synchronize(object){
//statement1
//statement2
//statement3
}
what happens to the lock on object if Thread-1 crashes on statement2, will JVM release the lock on Thread-1 automatically when this happens ? because otherwise if Thread-2 is wating for the lock on object to be released and Thread-1 crashes, the Thread-2 will wait forever.
It is defined in the JLS #14.19: