101 |
|
final Exchanger e = new Exchanger(); |
102 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
103 |
|
public void realRun() throws Exception { |
104 |
– |
long timeoutMillis = SHORT_DELAY_MS; |
104 |
|
long startTime = System.nanoTime(); |
105 |
|
try { |
106 |
< |
e.exchange(null, timeoutMillis, MILLISECONDS); |
106 |
> |
e.exchange(null, timeoutMillis(), MILLISECONDS); |
107 |
|
shouldThrow(); |
108 |
< |
} catch (TimeoutException success) { |
109 |
< |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis); |
111 |
< |
} |
108 |
> |
} catch (TimeoutException success) {} |
109 |
> |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); |
110 |
|
}}); |
111 |
|
|
112 |
|
awaitTermination(t); |
140 |
|
|
141 |
|
await(exchanged); |
142 |
|
t1.interrupt(); |
145 |
– |
interrupted.countDown(); |
143 |
|
awaitTermination(t1); |
144 |
+ |
interrupted.countDown(); |
145 |
|
awaitTermination(t2); |
146 |
|
awaitTermination(t3); |
147 |
|
} |