private void deactivate() { Scheduler.Task oldTimeout = _timeout.getAndSet(null); if (oldTimeout != null) oldTimeout.cancel(); }
/** * If scavenging is not scheduled, schedule it. * @throws Exception if any error during scheduling the scavenging */ protected void startScavenging() throws Exception { synchronized (this) { if (_scheduler != null) { //cancel any previous task if (_task!=null) _task.cancel(); if (_runner == null) _runner = new Runner(); LOG.info("{} Scavenging every {}ms", _sessionIdManager.getWorkerName(), _intervalMs); _task = _scheduler.schedule(_runner,_intervalMs,TimeUnit.MILLISECONDS); } } }
/** * Stop the scavenger. */ @Override public void doStop () throws Exception { synchronized(this) { if (_task!=null) _task.cancel(); _task=null; if (_ownScheduler && _scheduler !=null) _scheduler.stop(); _scheduler=null; } _sessionIds.clear(); super.doStop(); }
public void setIdleTimeout(long idleTimeout) { long old=_idleTimeout; _idleTimeout = idleTimeout; // Do we have an old timeout if (old>0) { // if the old was less than or equal to the new timeout, then nothing more to do if (old<=idleTimeout) return; // old timeout is too long, so cancel it. Scheduler.Task oldTimeout = _timeout.getAndSet(null); if (oldTimeout != null) oldTimeout.cancel(); } // If we have a new timeout, then check and reschedule if (idleTimeout>0 && isOpen()) _idleTask.run(); }
/** * Stop the scavenger. */ @Override public void doStop () throws Exception { synchronized(this) { if (_task!=null) _task.cancel(); _task=null; if (_ownScheduler && _scheduler !=null) _scheduler.stop(); _scheduler=null; } _sessionIds.clear(); super.doStop(); }
public void setIdleTimeout(long idleTimeout) { long old=_idleTimeout; _idleTimeout = idleTimeout; // Do we have an old timeout if (old>0) { // if the old was less than or equal to the new timeout, then nothing more to do if (old<=idleTimeout) return; // old timeout is too long, so cancel it. Scheduler.Task oldTimeout = _timeout.getAndSet(null); if (oldTimeout != null) oldTimeout.cancel(); } // If we have a new timeout, then check and reschedule if (idleTimeout>0 && isOpen()) _idleTask.run(); }
@Override protected void doStop() throws Exception { synchronized (_rate) { if (_task!=null) _task.cancel(); _task = null; for (AbstractConnector c : _connectors) c.removeBean(this); if (_server != null) _connectors.clear(); _limiting = false; } }
public boolean cancel() { org.eclipse.jetty.util.thread.Scheduler.Task task = _task; return task != null && task.cancel(); }
private void scheduleIdleTimeout(long delay) { Scheduler.Task newTimeout = null; if (isOpen() && delay > 0 && _scheduler != null) newTimeout = _scheduler.schedule(_idleTask, delay, TimeUnit.MILLISECONDS); Scheduler.Task oldTimeout = _timeout.getAndSet(newTimeout); if (oldTimeout != null) oldTimeout.cancel(); }
private void deactivate() { Scheduler.Task t = task.getAndSet(null); if (t != null) { boolean cancelled = t.cancel(); if (LOG.isDebugEnabled()) LOG.debug("Cancelled ({}) sweep task {}", cancelled, t); } }
public void cancelTimeoutTask() { Scheduler.Task task=_timeoutTask; _timeoutTask=null; if (task!=null) task.cancel(); }
private void deactivate() { Scheduler.Task oldTimeout = _timeout.getAndSet(null); if (oldTimeout != null) oldTimeout.cancel(); }
private void deactivate() { Scheduler.Task t = task.getAndSet(null); if (t != null) { boolean cancelled = t.cancel(); if (LOG.isDebugEnabled()) LOG.debug("Cancelled ({}) sweep task {}", cancelled, t); } }
public void failed(Throwable failure) { if (failed.compareAndSet(false, true)) { timeout.cancel(); closeNoExceptions(channel); ManagedSelector.this._selectorManager.connectionFailed(channel, failure, attachment); } }
@Override public void onComplete(Result result) { Scheduler.Task task = this.task.getAndSet(null); if (task != null) { boolean cancelled = task.cancel(); LOG.debug("Cancelled (successfully: {}) timeout task {}", cancelled, task); } }
private void scheduleIdleTimeout(long delay) { Scheduler.Task newTimeout = null; if (isOpen() && delay > 0 && _scheduler != null) newTimeout = _scheduler.schedule(_idleTask, delay, TimeUnit.MILLISECONDS); Scheduler.Task oldTimeout = _timeout.getAndSet(newTimeout); if (oldTimeout != null) oldTimeout.cancel(); }
protected void cancelTimeout() { AsyncEventState event=_event; if (event!=null) { Scheduler.Task task=event._timeout; if (task!=null) task.cancel(); } }
private void deactivate() { Scheduler.Task oldTimeout = _timeout.getAndSet(null); if (oldTimeout != null) oldTimeout.cancel(); }
@Override public void onComplete(Result result) { Scheduler.Task task = this.task.getAndSet(null); if (task != null) { boolean cancelled = task.cancel(); LOG.debug("Cancelled (successfully: {}) timeout task {}", cancelled, task); } }
private boolean cancelTimeout() { // Cannot rely on the return value of task.cancel() // since it may be invoked when the task is in run() // where cancellation is not possible (it's too late). boolean cancelled = cancel.compareAndSet(false, true); task.cancel(); return cancelled; }