146 |
|
long lastTime = System.nanoTime(); |
147 |
|
while (n-- > 0) { |
148 |
|
Future<T> f = ecs.poll(nanos, TimeUnit.NANOSECONDS); |
149 |
< |
if (f == null) { |
150 |
< |
if (nanos <= 0) |
151 |
< |
throw new TimeoutException(); |
152 |
< |
long now = System.nanoTime(); |
153 |
< |
nanos -= now - lastTime; |
154 |
< |
lastTime = now; |
155 |
< |
} |
149 |
> |
if (f == null) |
150 |
> |
throw new TimeoutException(); |
151 |
|
try { |
152 |
|
return f.get(); |
153 |
|
} catch(ExecutionException eex) { |
155 |
|
} catch(RuntimeException rex) { |
156 |
|
re = rex; |
157 |
|
} |
158 |
+ |
long now = System.nanoTime(); |
159 |
+ |
nanos -= now - lastTime; |
160 |
+ |
lastTime = now; |
161 |
|
} |
162 |
|
if (ee != null) |
163 |
|
throw ee; |
227 |
|
long lastTime = System.nanoTime(); |
228 |
|
while (n-- > 0) { |
229 |
|
Future<T> f = ecs.poll(nanos, TimeUnit.NANOSECONDS); |
230 |
< |
if (f == null) { |
231 |
< |
if (nanos <= 0) |
234 |
< |
throw new TimeoutException(); |
235 |
< |
long now = System.nanoTime(); |
236 |
< |
nanos -= now - lastTime; |
237 |
< |
lastTime = now; |
238 |
< |
} |
230 |
> |
if (f == null) |
231 |
> |
throw new TimeoutException(); |
232 |
|
try { |
233 |
|
return f.get(); |
234 |
|
} catch(ExecutionException eex) { |
236 |
|
} catch(RuntimeException rex) { |
237 |
|
re = rex; |
238 |
|
} |
239 |
+ |
long now = System.nanoTime(); |
240 |
+ |
nanos -= now - lastTime; |
241 |
+ |
lastTime = now; |
242 |
|
} |
243 |
|
if (ee != null) |
244 |
|
throw ee; |
303 |
|
return futures; |
304 |
|
try { |
305 |
|
f.get(nanos, TimeUnit.NANOSECONDS); |
310 |
– |
long now = System.nanoTime(); |
311 |
– |
nanos -= now - lastTime; |
312 |
– |
lastTime = now; |
306 |
|
} catch(CancellationException ignore) { |
307 |
|
} catch(ExecutionException ignore) { |
308 |
|
} catch(TimeoutException toe) { |
309 |
|
return futures; |
310 |
|
} |
311 |
+ |
long now = System.nanoTime(); |
312 |
+ |
nanos -= now - lastTime; |
313 |
+ |
lastTime = now; |
314 |
|
} |
315 |
|
} |
316 |
|
done = true; |
373 |
|
return futures; |
374 |
|
try { |
375 |
|
f.get(nanos, TimeUnit.NANOSECONDS); |
380 |
– |
long now = System.nanoTime(); |
381 |
– |
nanos -= now - lastTime; |
382 |
– |
lastTime = now; |
376 |
|
} catch(CancellationException ignore) { |
377 |
|
} catch(ExecutionException ignore) { |
378 |
|
} catch(TimeoutException toe) { |
379 |
|
return futures; |
380 |
|
} |
381 |
+ |
long now = System.nanoTime(); |
382 |
+ |
nanos -= now - lastTime; |
383 |
+ |
lastTime = now; |
384 |
|
} |
385 |
|
} |
386 |
|
done = true; |