1065 |
|
public void testTimedInvokeAny5() throws Exception { |
1066 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1067 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1068 |
+ |
long startTime = System.nanoTime(); |
1069 |
|
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1070 |
|
l.add(new StringTask()); |
1071 |
|
l.add(new StringTask()); |
1072 |
< |
String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
1072 |
> |
String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
1073 |
|
assertSame(TEST_STRING, result); |
1074 |
+ |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
1075 |
|
} |
1076 |
|
} |
1077 |
|
|