585 |
|
/** |
586 |
|
* Returns the shortest timed delay. This can be scaled up for |
587 |
|
* slow machines using the jsr166.delay.factor system property, |
588 |
< |
* or via jtreg's -timeoutFactor:<val> flag. |
588 |
> |
* or via jtreg's -timeoutFactor: flag. |
589 |
|
* http://openjdk.java.net/jtreg/command-help.html |
590 |
|
*/ |
591 |
|
protected long getShortDelay() { |
1466 |
|
return new LatchAwaiter(latch); |
1467 |
|
} |
1468 |
|
|
1469 |
< |
public void await(CountDownLatch latch) { |
1469 |
> |
public void await(CountDownLatch latch, long timeoutMillis) { |
1470 |
|
try { |
1471 |
< |
if (!latch.await(LONG_DELAY_MS, MILLISECONDS)) |
1471 |
> |
if (!latch.await(timeoutMillis, MILLISECONDS)) |
1472 |
|
fail("timed out waiting for CountDownLatch for " |
1473 |
< |
+ (LONG_DELAY_MS/1000) + " sec"); |
1473 |
> |
+ (timeoutMillis/1000) + " sec"); |
1474 |
|
} catch (Throwable fail) { |
1475 |
|
threadUnexpectedException(fail); |
1476 |
|
} |
1477 |
|
} |
1478 |
|
|
1479 |
+ |
public void await(CountDownLatch latch) { |
1480 |
+ |
await(latch, LONG_DELAY_MS); |
1481 |
+ |
} |
1482 |
+ |
|
1483 |
|
public void await(Semaphore semaphore) { |
1484 |
|
try { |
1485 |
|
if (!semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS)) |