1410 |
|
return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); |
1411 |
|
} |
1412 |
|
|
1413 |
– |
// void assertTerminatesPromptly(long timeoutMillis, Runnable r) { |
1414 |
– |
// long startTime = System.nanoTime(); |
1415 |
– |
// try { |
1416 |
– |
// r.run(); |
1417 |
– |
// } catch (Throwable fail) { threadUnexpectedException(fail); } |
1418 |
– |
// if (millisElapsedSince(startTime) > timeoutMillis/2) |
1419 |
– |
// throw new AssertionError("did not return promptly"); |
1420 |
– |
// } |
1421 |
– |
|
1422 |
– |
// void assertTerminatesPromptly(Runnable r) { |
1423 |
– |
// assertTerminatesPromptly(LONG_DELAY_MS/2, r); |
1424 |
– |
// } |
1425 |
– |
|
1413 |
|
/** |
1414 |
|
* Checks that timed f.get() returns the expected value, and does not |
1415 |
|
* wait for the timeout to elapse before returning. |