@Override public void suspend() { scheduledTask.cancel(true); super.suspend(); }
public void orCancel() { if (!wasQueued()) { task.cancel(false); } } }
@Override public void close() throws IOException { LoadingCache<Map<String, ?>, Pool<SshTool>> sshPoolCacheOrNullRef = sshPoolCacheOrNull; Task<?> cleanupTaskRef = cleanupTask; if (sshPoolCacheOrNullRef != null) { if (LOG.isDebugEnabled()) { LOG.debug("{} invalidating all entries in ssh pool cache. Final stats: {}", this, sshPoolCacheOrNullRef.stats()); } sshPoolCacheOrNullRef.invalidateAll(); } if (cleanupTaskRef != null) { cleanupTaskRef.cancel(false); } cleanupTask = null; sshPoolCacheOrNull = null; }
public void stop() { if (log.isDebugEnabled()) log.debug("Stopping poll for {} (using {})", new Object[] {entity, this}); if (!started) { throw new IllegalStateException(String.format("Attempt to stop poller %s of entity %s when not running", this, entity)); } started = false; for (Task<?> task : oneOffTasks) { if (task != null) task.cancel(true); } for (ScheduledTask task : tasks) { if (task != null) task.cancel(); } oneOffTasks.clear(); tasks.clear(); }
private void stop(ManagementNodeState newState) { boolean wasRunning = running; running = false; setInternalNodeState(newState); if (pollingTask != null) pollingTask.cancel(true); if (wasRunning) { try { publishHealth(); } catch (Exception e) { Exceptions.propagateIfFatal(e); LOG.error("Problem publishing manager-node health on termination (continuing)", e); } } }
protected Object invokeEffector(Entity targetEntity, Effector<?> effector, Map<String, ?> effectorParams, Duration timeout) throws ExecutionException, TimeoutException { Task<?> task; if (effectorParams == null || effectorParams.isEmpty()) { task = Entities.invokeEffector(TestEffectorImpl.this, targetEntity, effector); } else { task = Entities.invokeEffector(TestEffectorImpl.this, targetEntity, effector, effectorParams); } try { return task.get(timeout); } catch (InterruptedException e) { task.cancel(true); throw Exceptions.propagate(e); } catch (TimeoutException e) { task.cancel(true); throw e; } } }
@Override protected <T> Task<?> newThrottledEffectorTask(Entity target, Effector<T> effector, Map<?, ?> arguments, boolean isPrivileged) { Task<?> unsubmitted = super.newThrottledEffectorTask(target, effector, arguments, isPrivileged); unsubmitted.cancel(true); return unsubmitted; } }
log.debug("Cancelling "+t+" on "+entity); tasksCancelled.add(t); t.cancel(true); } catch (Exception e) { Exceptions.propagateIfFatal(e);
if (pollingTask!=null) pollingTask.cancel(true);
t.cancel(true); Assert.assertTrue(t.isDone());
vt.cancel(true); if (vm.isAbsent()) return (Maybe<T>)vm; v = vm.get();
if (pollingTask!=null) pollingTask.cancel(true); break; default:
((TaskInternal<?>)t).cancel(); } else if (cancellationMode instanceof Boolean) { t.cancel((Boolean)cancellationMode); } else if (cancellationMode instanceof TaskCancellationMode) { ((TaskInternal<?>)t).cancel((TaskCancellationMode)cancellationMode);