Refine search
private void push() { if (DELAY_SECONDS < 0) return; synchronized (lock) { // Can be done or canceled in case of a bug or external intervention - do not allow it to hang there forever if (nextSave != null && !(nextSave.isDone() || nextSave.isCancelled())) return; nextSave = Timer.get().schedule(this, DELAY_SECONDS, TimeUnit.SECONDS); } }
@Override public void stop() { for (Future<?> future: this.expirationFutures.values()) { future.cancel(true); } for (Future<?> future: this.expirationFutures.values()) { if (!future.isCancelled() && !future.isDone()) { try { future.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { // Ignore } } } for(Map.Entry<K, Entry<V>> entry : entries.entrySet()) { this.factory.destroyInstance(entry.getValue().getValue()); } this.expirationFutures.clear(); this.entries.clear(); }
public void runFutures() throws ExecutionException, InterruptedException { while (futures.peek() != null) { Future<?> future = futures.poll(); if (!future.isCancelled()) { future.get(); } } }
@Override public void run() { boolean failures = false; INSTALLING: while (true) { try { updateCenter.persistInstallStatus(); Thread.sleep(500); failures = false; for (Future<UpdateCenter.UpdateCenterJob> jobFuture : installJobs) { if(!jobFuture.isDone() && !jobFuture.isCancelled()) { continue INSTALLING; } UpdateCenter.UpdateCenterJob job = jobFuture.get(); if(job instanceof InstallationJob && ((InstallationJob)job).status instanceof DownloadJob.Failure) { failures = true; } } } catch (Exception e) { LOGGER.log(WARNING, "Unexpected error while waiting for initial plugin set to install.", e); } break; } updateCenter.persistInstallStatus(); if(!failures) { try (ACLContext acl = ACL.as(currentAuth)) { InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_PLUGINS_INSTALLING); } } } }.start();
public static <R> CallbackResult<R> createFromFuture(Future<R> execFuture) throws InterruptedException { Preconditions.checkNotNull(execFuture); if (execFuture.isCancelled()) { return createCancelled(); } try { R res = execFuture.get(); return createSuccessful(res); } catch (ExecutionException e) { if (execFuture.isCancelled()) { return createCancelled(); } else { return createFailed(e.getCause()); } } } }
public void cacelAllFutures() { for (Future future : futures) { if (!future.isDone() && !future.isCancelled()) { future.cancel(true); } } }
return src.isCancelled(); return src.isDone(); return src.get(); return src.get();
if (futureOrLong instanceof Future) { Future future = (Future) futureOrLong; if (future.isCancelled()) { continue; future.get(5, TimeUnit.SECONDS); setLastCachedId(ASYNC_ADD, lastPending); } catch (CancellationException ok) {
private void clearCompletedFutures() { futures.removeIf(future -> future.isCancelled() || future.isDone()); }
if (futureOrLong instanceof Future) { Future future = (Future) futureOrLong; if (future.isDone()) { if (future.isCancelled()) { it.remove(); } else { future.get(0, TimeUnit.SECONDS);
if(f.isCancelled()) { logger.warn("Get operation timed out after " + timeoutMs + " ms."); continue; GetAllResult getResult = f.get(); if(getResult.exception != null) { if(getResult.exception instanceof VoldemortApplicationException) {
@Override public void run() { INSTALLING: while (true) { for (Future<UpdateCenter.UpdateCenterJob> deployJob : installJobs) { try { Thread.sleep(500); } catch (InterruptedException e) { LOGGER.log(SEVERE, "Unexpected error while waiting for some plugins to install. Plugin Manager state may be invalid. Please restart Jenkins ASAP.", e); } if (!deployJob.isCancelled() && !deployJob.isDone()) { // One of the plugins is not installing/canceled, so // go back to sleep and try again in a while. continue INSTALLING; } } // All the plugins are installed. It's now safe to refresh. resolveDependantPlugins(); break; } } }.start();
for (Map.Entry<NodeExecution, Future<NodeResult<T>>> entry : futures.entrySet()) { if (!entry.getValue().isDone() && !entry.getValue().isCancelled()) { done = false; } else { result.add(execution.getPositionalKey(), entry.getValue().get()); } else { result.add(entry.getValue().get());
if(f.isCancelled()) { logger.warn("Get operation timed out after " + timeoutMs + " ms."); continue; GetResult<R> getResult = f.get(); if(getResult.exception != null) { if(getResult.exception instanceof VoldemortApplicationException) {
@ManagedAttribute public boolean getStableTaskRunning() { stable_task_lock.lock(); try { return stable_task_future != null && !stable_task_future.isDone() && !stable_task_future.isCancelled(); } finally { stable_task_lock.unlock(); } }
DistributedMember returnedMember = futureTask.get(); String memberId = returnedMember != null ? returnedMember.getId() : null; if (futureTask.isDone()) { if (isDebugEnabled) { logger.debug("Monitoring Resource Created for : {}", memberId); if (futureTask.isCancelled()) {
while (processingExecutorService.futures.peek() != null) { Future<?> future = processingExecutorService.futures.poll(); if (future.isCancelled()) { cancelledTaskFutureCount++; } else { future.get();
@ManagedAttribute public boolean isOpenerScheduled() { return barrier_opener_future != null && !barrier_opener_future.isDone() && !barrier_opener_future.isCancelled(); }
final Future<?> f = Single.never().toFuture(); assertFalse(f.isCancelled()); assertFalse(f.isDone()); assertTrue(f.isCancelled()); assertTrue(f.isDone()); f.get(); fail("Should have thrown!"); } catch (CancellationException ex) { f.get(5, TimeUnit.SECONDS); fail("Should have thrown!"); } catch (CancellationException ex) {
for (Future<Object> result : results) { try { result.get(); } catch (InterruptedException e) { theStore.brokerService.handleIOException(new IOException(e.getMessage())); }catch(CancellationException e) { if (!result.isCancelled()) { doneSomething = true;