355 |
|
* Reset of a barrier after timeout reinitializes it. |
356 |
|
*/ |
357 |
|
public void testResetAfterTimeout() throws Exception { |
358 |
< |
final CyclicBarrier start = new CyclicBarrier(3); |
358 |
> |
final CyclicBarrier start = new CyclicBarrier(2); |
359 |
|
final CyclicBarrier barrier = new CyclicBarrier(3); |
360 |
|
for (int i = 0; i < 2; i++) { |
361 |
|
Thread t1 = new ThreadShouldThrow(TimeoutException.class) { |
362 |
|
public void realRun() throws Exception { |
363 |
|
start.await(); |
364 |
< |
barrier.await(MEDIUM_DELAY_MS, MILLISECONDS); |
364 |
> |
barrier.await(SHORT_DELAY_MS, MILLISECONDS); |
365 |
|
}}; |
366 |
|
|
367 |
|
Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { |
372 |
|
|
373 |
|
t1.start(); |
374 |
|
t2.start(); |
375 |
– |
start.await(); |
375 |
|
t1.join(); |
376 |
|
t2.join(); |
377 |
|
assertTrue(barrier.isBroken()); |