for (int i = 0; i < ipList.size(); i++) { try { Future<SampleResult> f = completionService.poll(1000, TimeUnit.MILLISECONDS); try {
Future<Pair<Long, AccumuloColumnConstraint>> futureCardinality = executor.poll(); if (futureCardinality != null && futureCardinality.isDone()) { Pair<Long, AccumuloColumnConstraint> columnCardinality = futureCardinality.get();
long waitTimeUs = combinedCtx.combineStartUs + maxWaitUs - System.nanoTime(); if (waitTimeUs >= 0) { Future<AcidDirInfo> f = ecs.poll(waitTimeUs, TimeUnit.NANOSECONDS); adi = (f == null) ? null : f.get();
long waitTimeUs = combinedCtx.combineStartUs + maxWaitUs - System.nanoTime(); if (waitTimeUs >= 0) { Future<AcidDirInfo> f = ecs.poll(waitTimeUs, TimeUnit.NANOSECONDS); adi = (f == null) ? null : f.get();
while ( ( unprocessed = service.poll() ) != null )
try { Future<IFileProcessorFutureResult> futureResult = completionService.poll(1, TimeUnit.SECONDS);
while (results < numTesters) { Future<MyTestResult> futureResult = completionService.poll(1, TimeUnit.SECONDS); if (futureResult != null) { results++;
Future<IFileProcessorFutureResult> future = null; try { future = completionService.poll(10, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.warn("thread interrupt while polling in final shutdown loop");
assertNull( "proposer should continue to block without quorum", leadershipCompletionService.poll( NO_QUORUM_POLL_WAIT_TIME_IN_MS, TimeUnit.MILLISECONDS)); assertNotNull( "proposer should get leadership with quorum", leadershipCompletionService.poll( QUORUM_POLL_WAIT_TIME_IN_MS, TimeUnit.MILLISECONDS));
private boolean awaitTermination(CompletionService<String> service, int n, long maxWait) throws InterruptedException { long finalTime = System.currentTimeMillis() + maxWait; long timeDiff; for (int i = 0; i < n; i++) { timeDiff = finalTime - System.currentTimeMillis(); if (service.poll(timeDiff > 0 ? timeDiff : 1, TimeUnit.MILLISECONDS) == null) { return false; } } return true; }
private synchronized T poll() { Future<T> future = completionService_.poll(); if(future == null) return null; taskCnt_--; return remove(future); }
public Future<T> poll(long timeout, TimeUnit unit) throws InterruptedException { return check(delegate.poll(timeout, unit)); } }
public Future<T> poll(final long timeout, @Nonnull final TimeUnit unit) throws InterruptedException { return check(delegate.poll(timeout, unit)); } }
public Future<T> poll() { return check(delegate.poll()); }
public Future<T> poll() { return check(delegate.poll()); }
@Override public T apply(final CompletionService<T> completionService) { try { final Future<T> future = completionService.poll(timeout.getTime(), timeout.getUnit()); if (future == null) { cancelRemaining(); throw timeout.getTimeoutException(); } futures.remove(future); return future.get(); } catch (final InterruptedException e) { throw new RuntimeInterruptedException(e); } catch (final ExecutionException e) { throw new RuntimeExecutionException(e); } }
@Override public T apply(final CompletionService<T> completionService) { try { final Future<T> future = completionService.poll(timeout.getTime(), timeout.getUnit()); if (future == null) { cancelRemaining(); throw timeout.getTimeoutException(); } futures.remove(future); return future.get(); } catch (final InterruptedException e) { throw new RuntimeInterruptedException(e); } catch (final ExecutionException e) { throw new RuntimeExecutionException(e); } }
@Test(expected = CPUReactiveAuditException.class) public void poll() throws InterruptedException { TestTools.strict.commit(); CompletionService<Object> q = new ExecutorCompletionService<Object>(e); q.poll(1, TimeUnit.MILLISECONDS); }