channelFutureToCancel.cancel();
public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { ctx.sendDownstream(e); } else if (future.isCancelled()) { e.getFuture().cancel(); } else { e.getFuture().setFailure(future.getCause()); } } }
connectCheck.await(); } catch (InterruptedException e) { connectCheck.cancel(); connectCheck.getChannel().getCloseFuture().awaitUninterruptibly(); factory.releaseExternalResources();
future.cancel();
future.cancel();
channelFuture.cancel(); throw new MotanServiceException("NettyChannel failed to connect to server, url: " + nettyClient.getUrl().getUri()+ ", result: " + result + ", success: " + success + ", connected: " + connected, channelFuture.getCause()); } else { channelFuture.cancel(); throw new MotanServiceException("NettyChannel connect to server timeout url: " + nettyClient.getUrl().getUri() + ", cost: " + (System.currentTimeMillis() - start) + ", result: " + result + ", success: " + success + ", connected: " + connected);
writeFuture.cancel(); response = this.nettyClient.removeCallback(request.getRequestId());
@Override public boolean cancel(final boolean arg0) { return future.cancel(); }
@Override public final void writeRequested(ChannelHandlerContext ctx, MessageEvent me) throws Exception { Object message = me.getMessage(); if (me.getMessage() instanceof CoapMessage) { if (!handleOutboundCoapMessage((CoapMessage) message, (InetSocketAddress) me.getRemoteAddress())) { me.getFuture().cancel(); return; } } ctx.sendDownstream(me); }
/** * End the transport handler, closing the underlying connection. * */ public void end() { keepingAlive = false; if (channel == null) { channel = connectFuture.getChannel(); connectFuture.cancel(); } if (channel != null) { channel.close(); } }
if (!latch.await(2, TimeUnit.SECONDS)) { connectFuture.removeListener(listener); connectFuture.cancel(); throw new ExecutionException(new TimeoutException("创建链接2秒超时"));
+ serverInfo.getPort()); try { fapp.cancel(); Thread.sleep(5000L); } catch (Exception e) {
boolean isCanceled = connectFuture.cancel(); logger.error("connectFuture: isCanceled {} isDone {} isSuccess {}", isCanceled, connectFuture.isDone(), connectFuture.isSuccess()); throw new SmppChannelConnectTimeoutException("Could not connect to the server within timeout");
@Override public void operationComplete(final ChannelFuture f) throws Exception { if (f.isCancelled()) { handlerFuture.cancel(); } else if (!f.isSuccess()) { handlerFuture.setFailure(f.getCause()); } else { // on success or incomplete // when barrier future complete, trigger handler future Barrier barrier = getBarrier(); ChannelFuture barrierFuture = barrier.getFuture(); barrierFuture.addListener(chainedFuture(handlerFuture)); } } });
@Override public void operationComplete(final ChannelFuture f) throws Exception { // If the pipeline was not complete successfully we dont want nor need to wait for the barrier if (!f.isSuccess()) { if (f.isCancelled()) { handlerFuture.cancel(); } else { handlerFuture.setFailure(f.getCause()); } } else { // when barrier future complete, trigger handler future Barrier barrier = getBarrier(); ChannelFuture barrierFuture = barrier.getFuture(); barrierFuture.addListener(chainedFuture(handlerFuture)); } } });
future.cancel();
future.cancel();
future.cancel();