Side effects of throwing an exception inside a synchronized clause?

exception, java, synchronized

Solution

I see no side-effect.

The lock is guaranteed to be terminated in all cases, and an exception is no exception (pun intended).

Problem

Are there any unclear side effects to throwing an exception from within a synchronized clause? What happens to the lock? ``` private void doSomething() throws Exception {...} synchronized (lock) { doSomething(); } ```

Original source