Package org.jboss.netty.channel

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


    bootstrap.setOption("tcpNoDelay", true);

    // Make a new connection.
    ChannelFuture channelFuture = bootstrap.connect(addr);
    channelFuture.awaitUninterruptibly();
    if (!channelFuture.isSuccess()) {
      channelFuture.getCause().printStackTrace();
      throw new RuntimeException(channelFuture.getCause());
    }
    channel = channelFuture.getChannel();
View Full Code Here


        // wait for the write
        if (LOG.isTraceEnabled()) {
            LOG.trace("Waiting for write to complete");
        }
        future.awaitUninterruptibly();

        // if it was not a success then thrown an exception
        if (!future.isSuccess()) {
            LOG.warn("Cannot write body: " + body + " using channel: " + channel);
            throw new CamelExchangeException("Cannot write body", exchange, future.getCause());
View Full Code Here

            channelFuture = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
        } else {
            throw new IllegalStateException("Should either be TCP or UDP");
        }

        channelFuture.awaitUninterruptibly();
        if (!channelFuture.isSuccess()) {
            throw new CamelException("Cannot connect to " + configuration.getAddress(), channelFuture.getCause());
        }
        channel = channelFuture.getChannel();
        // to keep track of all channels in use
View Full Code Here

   
    // Close the channel:
    if (channelToClose != null) {
      ChannelFuture closeFuture = channelToClose.close();
      if (awaitCompletion && (closeFuture != null)) {
        closeFuture.awaitUninterruptibly(connectTimeoutMillis);
      }
    }
  }
 
  /**
 
View Full Code Here

      stateLock.writeLock().lock();
      try {
        if (!isChannelReady(channel)) {
          LOG.debug("Connecting to " + remoteAddr);
          ChannelFuture channelFuture = bootstrap.connect(remoteAddr);
          channelFuture.awaitUninterruptibly(connectTimeoutMillis);
          if (!channelFuture.isSuccess()) {
            throw new IOException("Error connecting to " + remoteAddr,
                channelFuture.getCause());
          }
          channel = channelFuture.getChannel();
View Full Code Here

   
    // Close the channel:
    if (channelToClose != null) {
      ChannelFuture closeFuture = channelToClose.close();
      if (awaitCompletion && (closeFuture != null)) {
        closeFuture.awaitUninterruptibly(connectTimeoutMillis);
      }
    }
  }
 
  /**
 
View Full Code Here

            bootstrap.setPipelineFactory(new PipelineFactory());
        }
        ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));

        // Wait until the connection attempt succeeds or fails.
        channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess())
        {
            bootstrap.releaseExternalResources();
            throw new IOException("Connection Error", future.getCause());
        }
View Full Code Here

      stateLock.readLock().unlock();
      stateLock.writeLock().lock();
      try {
        LOG.info("Connecting to " + remoteAddr);
        ChannelFuture channelFuture = bootstrap.connect(remoteAddr);
        channelFuture.awaitUninterruptibly();
        if (!channelFuture.isSuccess()) {
          channelFuture.getCause().printStackTrace();
          throw new IOException("Error connecting to " + remoteAddr,
              channelFuture.getCause());
        }
View Full Code Here

    try {
      if (channel != null) {
        LOG.info("Disconnecting from " + remoteAddr);
        ChannelFuture closeFuture = channel.close();
        if (awaitCompletion) {
          closeFuture.awaitUninterruptibly();
        }
        channel = null;
        remote = null;
        if (cancelPendingRequests) {
          // Remove all pending requests (will be canceled after relinquishing
View Full Code Here

        if (future == null) {
            log.info(MeshyServer.this + " peer connect returned null future to " + address);
            return;
        }
        /* wait for connection to complete */
        future.awaitUninterruptibly();
        if (!future.isSuccess()) {
            log.warn(MeshyServer.this + " peer connect fail to " + address);
        }
    }

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.