Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFuture.cancel()


      future.addListener(completionListener);
      return new Future<Void>() {

        @Override
        public boolean cancel(boolean arg0) {
          return future.cancel();
        }

        @Override
        public Void get() throws InterruptedException,
            ExecutionException {
View Full Code Here


    });
    // Wait at least futureTimeout for the operation to complete
    cf.awaitUninterruptibly(futureTimeout);
    // If the operation is not complete, cancel it.
    if(!cf.isDone()) {
      clog("Channel Future Still Waiting. Cancelled:" + cf.cancel());
    }
  }
 
  public static void clog(Object msg) {
    System.out.println("[Client][" + Thread.currentThread() + "]:" + msg);
View Full Code Here

          channelFutureToCancel = channelFuture;
          channelFuture = null;
        }
    }
    if (channelFutureToCancel != null) {
      channelFutureToCancel.cancel();
    }
   
    if (stateReadLockHeld) {
      stateLock.readLock().unlock();
    }
View Full Code Here

            int timeOut = config.getConnectionTimeoutInMs() > 0 ? config.getConnectionTimeoutInMs() : Integer.MAX_VALUE;
            if (!channelFuture.awaitUninterruptibly(timeOut, TimeUnit.MILLISECONDS)) {
                if (acquiredConnection) {
                    freeConnections.release();
                }
                channelFuture.cancel();
                abort(c.future(), new ConnectException(String.format("Connect operation to %s timeout %s", uri, timeOut)));
            }

            try {
                c.operationComplete(channelFuture);
View Full Code Here

        .connect(new InetSocketAddress(host, port));

    connectFuture.addListener(listener);
    if (!latch.await(2, TimeUnit.SECONDS)) {
      connectFuture.removeListener(listener);
      connectFuture.cancel();
      throw new ExecutionException(new TimeoutException("创建链接2秒超时"));
    }
    if (!connectFuture.isSuccess()) {
      throw new RuntimeException("connect server fail " + host,
          connectFuture.getCause());
View Full Code Here

                        + getConnectTimeout() + "ms (elapsed: " + (System.currentTimeMillis() - start) + "ms) from netty client "
                        + NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion());
            }
        }finally{
            if (! isConnected()) {
                future.cancel();
            }
        }
    }

    @Override
View Full Code Here

                        + getConnectTimeout() + "ms (elapsed: " + (System.currentTimeMillis() - start) + "ms) from netty client "
                        + NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion());
            }
        }finally{
            if (! isConnected()) {
                future.cancel();
            }
        }
    }

    @Override
View Full Code Here

            bootstrap.setOption("keepAlive", true);
            ChannelFuture connectCheck = bootstrap.connect(new InetSocketAddress(address, port));
            try {
                connectCheck.await();
            } catch (InterruptedException e) {
                connectCheck.cancel();
                connectCheck.getChannel().getCloseFuture().awaitUninterruptibly();
                factory.releaseExternalResources();
                throw e;
            }
            if (!connectCheck.isSuccess()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.