private void cancel(List<RFuture<?>> futures) { for (RFuture<?> future : futures) { future.cancel(true); } }
private void cancel(List<RFuture<?>> futures) { for (RFuture<?> future : futures) { future.cancel(true); } }
@Override public void operationComplete(Future<T> f) throws Exception { if (promise.isCancelled()) { future.cancel(true); } } });
@Override public void operationComplete(Future<T> f) throws Exception { if (promise.isCancelled()) { future.cancel(true); } } });
@Override public boolean cancel(boolean mayInterruptIfRunning) { super.cancel(mayInterruptIfRunning); return takeFuture.cancel(mayInterruptIfRunning); }; };
@Override public boolean cancel(boolean mayInterruptIfRunning) { super.cancel(mayInterruptIfRunning); return takeFuture.cancel(mayInterruptIfRunning); }; };
@Override public <T> void deregister(Class<T> remoteInterface) { for (Method method : remoteInterface.getMethods()) { RemoteServiceKey key = new RemoteServiceKey(remoteInterface, method.getName(), getMethodSignatures(method)); beans.remove(key); } Entry entry = remoteMap.remove(remoteInterface); if (entry != null && entry.getFuture() != null) { entry.getFuture().cancel(false); } }
@Override public <T> void deregister(Class<T> remoteInterface) { for (Method method : remoteInterface.getMethods()) { RemoteServiceKey key = new RemoteServiceKey(remoteInterface, method.getName(), getMethodSignatures(method)); beans.remove(key); } Entry entry = remoteMap.remove(remoteInterface); if (entry != null && entry.getFuture() != null) { entry.getFuture().cancel(false); } }
@Override public void run(Timeout timeout) throws Exception { CommandData<?, ?> commandData = connection.getCurrentCommand(); if ((commandData == null || !commandData.isBlockingCommand()) && (future.cancel(false) || !future.isSuccess())) { ctx.channel().close(); log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval()); } else { sendPing(ctx); } } }, config.getPingConnectionInterval(), TimeUnit.MILLISECONDS);
@Override public void run(Timeout timeout) throws Exception { CommandData<?, ?> commandData = connection.getCurrentCommand(); if ((commandData == null || !commandData.isBlockingCommand()) && (future.cancel(false) || !future.isSuccess())) { ctx.channel().close(); log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval()); } else { sendPing(ctx); } } }, config.getPingConnectionInterval(), TimeUnit.MILLISECONDS);
@Override public void operationComplete(Future<Void> future) throws Exception { if (future.isCancelled() && connectionFuture.cancel(false)) { log.debug("Connection obtaining canceled for batch"); details.getTimeout().cancel(); if (attemptPromise.cancel(false)) { free(entry); } } } };
@Override public void operationComplete(Future<Void> future) throws Exception { if (future.isCancelled() && connectionFuture.cancel(false)) { log.debug("Connection obtaining canceled for batch"); details.getTimeout().cancel(); if (attemptPromise.cancel(false)) { free(entry); } } } };
@Override public void operationComplete(Future<R> future) throws Exception { if (future.isCancelled() && connectionFuture.cancel(false)) { log.debug("Connection obtaining canceled for {}", command); details.getTimeout().cancel(); if (details.getAttemptPromise().cancel(false)) { free(params); } } } };
@Override public void operationComplete(Future<R> future) throws Exception { if (future.isCancelled() && connectionFuture.cancel(false)) { log.debug("Connection obtaining canceled for {}", command); details.getTimeout().cancel(); if (details.getAttemptPromise().cancel(false)) { free(params); } } } };
@Override public void scheduleAtFixedRate(ScheduledAtFixedRateParameters params) { long newStartTime = System.currentTimeMillis() + params.getPeriod(); params.setStartTime(newStartTime); RFuture<Void> future = asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()).scheduleAtFixedRate(params); try { executeRunnable(params); } catch (RuntimeException e) { // cancel task if it throws an exception future.cancel(true); throw e; } }
@Override public void scheduleAtFixedRate(ScheduledAtFixedRateParameters params) { long newStartTime = System.currentTimeMillis() + params.getPeriod(); params.setStartTime(newStartTime); RFuture<Void> future = asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()).scheduleAtFixedRate(params); try { executeRunnable(params); } catch (RuntimeException e) { // cancel task if it throws an exception future.cancel(true); throw e; } }
@Override public void schedule(ScheduledCronExpressionParameters params) { CronExpression expression = new CronExpression(params.getCronExpression()); expression.setTimeZone(TimeZone.getTimeZone(params.getTimezone())); Date nextStartDate = expression.getNextValidTimeAfter(new Date()); RFuture<Void> future = null; if (nextStartDate != null) { RemoteExecutorServiceAsync service = asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()); params.setStartTime(nextStartDate.getTime()); future = service.schedule(params); } try { executeRunnable(params, nextStartDate == null); } catch (RuntimeException e) { // cancel task if it throws an exception if (future != null) { future.cancel(true); } throw e; } }
@Override public void schedule(ScheduledCronExpressionParameters params) { CronExpression expression = new CronExpression(params.getCronExpression()); expression.setTimeZone(TimeZone.getTimeZone(params.getTimezone())); Date nextStartDate = expression.getNextValidTimeAfter(new Date()); RFuture<Void> future = null; if (nextStartDate != null) { RemoteExecutorServiceAsync service = asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()); params.setStartTime(nextStartDate.getTime()); future = service.schedule(params); } try { executeRunnable(params, nextStartDate == null); } catch (RuntimeException e) { // cancel task if it throws an exception if (future != null) { future.cancel(true); } throw e; } }
cancelRequestFuture.cancel(false);