2 * Test that locks taken in synchronized methods are properly unlocked
3 * when an exception occurs. Note that different mechanisms are used in
4 * compiler & interpreter.
6 * @author Godmar Back <gback@cs.utah.edu>
8 public class TestUnlock {
9 synchronized void throwException() throws Exception {
10 throw new Exception();
13 synchronized void success() {
14 System.out.println("Success.");
17 public static void main(String av[]) throws Exception {
18 final TestUnlock me = new TestUnlock();
24 } catch (Exception _) { }
25 System.out.println("Time out. Failure.");
30 Thread t = new Thread() {
34 } catch (Exception _) {
41 Thread t2 = new Thread() {