How to unlock a ReentrantLock Object when exception happens before unlock is called
<p>In the below If exception happens at syncMethod2() then how can i unlock the lock object? </p>

<pre><code>public class ReEntrantLock {
ReentrantLock lock = new ReentrantLock();

void syncMethod1() {
  lock.lock();
  syncMethod2(); // throw new NullPointerException();
  lock.unlock();
}

}
</code></pre>
