@Override public boolean isDone() { synchronized (this.triggerContextMonitor) { return obtainCurrentFuture().isDone(); } }
public void stopRegisterTask() { if (scheduledTask != null && !scheduledTask.isDone()) { scheduledTask.cancel(true); LOGGER.debug("Canceled registration task"); } }
/** * Stop periodically checking the plugin directory. */ public void stopMonitoring() { if ( monitorTaskScheduledFuture != null && !monitorTaskScheduledFuture.isDone() ) { // Cancel, with an interrupt if this task has been cancelled before. monitorTaskScheduledFuture.cancel( monitorTaskScheduledFuture.isCancelled() ); } }
public void startRegisterTask() { if (scheduledTask != null && !scheduledTask.isDone()) { return; } scheduledTask = taskScheduler.scheduleAtFixedRate(registrator::register, registerPeriod); LOGGER.debug("Scheduled registration task for every {}ms", registerPeriod); }
@Override public boolean isDone() { synchronized (this.triggerContextMonitor) { return obtainCurrentFuture().isDone(); } }
/** * Start the scan task for long-idle connections. */ private synchronized void startScan() { if (scanTaskFuture == null || scanTaskFuture.isCancelled() || scanTaskFuture.isDone()) { scanTaskFuture = TIMER.scheduleAtFixedRate( new ScanIdleConnectionTask(this), 10, 30, TimeUnit.SECONDS); } }
@InterfaceAudience.Private @Override public synchronized boolean isChoreScheduled(ScheduledChore chore) { return chore != null && scheduledChores.containsKey(chore) && !scheduledChores.get(chore).isDone(); }
public void scheduleReconnect() { if (reconnectionTask == null || reconnectionTask.isDone()) { reconnectionTask = reconnectionExecutor.scheduleWithFixedDelay( new ReconnectionTask(this), reconnectionDelay, reconnectionDelay, TimeUnit.MILLISECONDS); } }
Connection close() { ScheduledFuture<?> eol = endOfLife; if (eol != null && !eol.isDone() && !eol.cancel(false)) { LOGGER.warn("{} - maxLifeTime expiration task cancellation unexpectedly returned false for connection {}", getPoolName(), connection); } Connection con = connection; connection = null; endOfLife = null; return con; }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private synchronized void scheduleReconnect(boolean immediate) { if( !shutdown && (reconnectTask == null || reconnectTask.isDone())) { if( channel != null) { try { channel.shutdownNow().awaitTermination(1, TimeUnit.SECONDS); } catch(Exception ignored) { } } channel = null; reconnectTask = scheduler.schedule(this::tryReconnect, immediate ? 100 : 5000, TimeUnit.MILLISECONDS); } }
@Override protected synchronized void after() { if ( null != thunk && !thunk.isDone() ) { thunk.cancel( true ); } thunk = null; super.after(); }
private void scheduleTimeout(final ChannelHandlerContext ctx, final ChannelPromise promise) { // Schedule a timeout. final WriteTimeoutTask task = new WriteTimeoutTask(ctx, promise); task.scheduledFuture = ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS); if (!task.scheduledFuture.isDone()) { addWriteTimeoutTask(task); // Cancel the scheduled timeout if the flush promise is complete. promise.addListener(task); } }
private void checkConnectionState() { if (shutdown) { throw new AxonServerException(ErrorCode.CONNECTION_FAILED.errorCode(), "Shutdown in progress"); } if (reconnectTask != null && !reconnectTask.isDone()) { throw new AxonServerException(ErrorCode.CONNECTION_FAILED.errorCode(), "No connection to AxonServer available"); } }
public void testNoOpScheduledExecutor() throws InterruptedException { taskDone = false; Runnable task = new Runnable() { @Override public void run() { taskDone = true; } }; ScheduledFuture<?> future = TestingExecutors.noOpScheduledExecutor().schedule(task, 10, TimeUnit.MILLISECONDS); Thread.sleep(20); assertFalse(taskDone); assertFalse(future.isDone()); }
private void scheduleTimeout(final ChannelHandlerContext ctx, final ChannelPromise promise) { // Schedule a timeout. final WriteTimeoutTask task = new WriteTimeoutTask(ctx, promise); task.scheduledFuture = ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS); if (!task.scheduledFuture.isDone()) { addWriteTimeoutTask(task); // Cancel the scheduled timeout if the flush promise is complete. promise.addListener(task); } }
public void testServiceStartStop() throws Exception { NullService service = new NullService(); service.startAsync().awaitRunning(); assertFalse(future.isDone()); service.stopAsync().awaitTerminated(); assertTrue(future.isCancelled()); }