equal
deleted
inserted
replaced
75 } catch (InterruptedException | BrokenBarrierException e) { |
75 } catch (InterruptedException | BrokenBarrierException e) { |
76 throw new RuntimeException("Synchronization error happened.", e); |
76 throw new RuntimeException("Synchronization error happened.", e); |
77 } |
77 } |
78 } |
78 } |
79 |
79 |
80 public void test() { |
80 public void syncAndTest() { |
81 try { |
81 try { |
82 barrier.await(); |
82 barrier.await(); |
83 // wait until monitor is locked by a ::run method |
83 // wait until monitor is locked by a ::run method |
84 barrier.await(); |
84 barrier.await(); |
85 } catch (InterruptedException | BrokenBarrierException e) { |
85 } catch (InterruptedException | BrokenBarrierException e) { |
86 throw new RuntimeException("Synchronization error happened.", e); |
86 throw new RuntimeException("Synchronization error happened.", e); |
87 } |
87 } |
|
88 test(); |
|
89 } |
|
90 |
|
91 public void test() { |
88 synchronized(monitor) { |
92 synchronized(monitor) { |
89 BusyLock.field++; |
93 BusyLock.field++; |
90 } |
94 } |
91 } |
95 } |
92 |
96 |
128 AbortProvoker.inflateMonitor(busyLock.monitor); |
132 AbortProvoker.inflateMonitor(busyLock.monitor); |
129 } |
133 } |
130 |
134 |
131 Thread t = new Thread(busyLock); |
135 Thread t = new Thread(busyLock); |
132 t.start(); |
136 t.start(); |
133 busyLock.test(); |
137 busyLock.syncAndTest(); |
134 t.join(); |
138 t.join(); |
135 } |
139 } |
136 } |
140 } |