Package org.jboss.netty.channel

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


    final ChannelFuture futureConnect = boot.connect(address);

    channel = futureConnect.getChannel();

    final boolean isGoodConnect = futureConnect
        .awaitUninterruptibly(TIMEOUT);

    if (!isGoodConnect) {
      log.error("proxy connect error {}", futureConnect.getCause());
      log.error("proxy; {}:{} ", proxySettings.getProxyAddress(),
View Full Code Here


  }

  private DDF_FeedEvent blockingWrite(final CharSequence message) {
    final ChannelFuture futureWrite = channel.write(message);

    futureWrite.awaitUninterruptibly(TIMEOUT, TIME_UNIT);

    if (futureWrite.isSuccess()) {
      return DDF_FeedEvent.COMMAND_WRITE_SUCCESS;
    } else {
      return DDF_FeedEvent.COMMAND_WRITE_FAILURE;
View Full Code Here

      /* Netty attempt to connect to server */
      futureConnect = boot.connect(address);

      channel = futureConnect.getChannel();

      if (!futureConnect.awaitUninterruptibly(TIMEOUT, TIME_UNIT)) {
        log.error("channel connect timeout; {}:{} ", host, port);
        return DDF_FeedEvent.CHANNEL_CONNECT_TIMEOUT;
      }

      /* Handle connection attempt errors */
 
View Full Code Here

            future = channel.write(body);
        }

        // wait for the write
        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

      else
      {
         future = bootstrap.connect(remoteDestination);
      }

      future.awaitUninterruptibly();

      if (future.isSuccess())
      {
         final Channel ch = future.getChannel();
         SslHandler sslHandler = ch.getPipeline().get(SslHandler.class);
View Full Code Here

         final Channel ch = future.getChannel();
         SslHandler sslHandler = ch.getPipeline().get(SslHandler.class);
         if (sslHandler != null)
         {
            ChannelFuture handshakeFuture = sslHandler.handshake();
            if (handshakeFuture.awaitUninterruptibly(30000))
            {
                if (handshakeFuture.isSuccess())
                {
                    ch.getPipeline().get(HornetQChannelHandler.class).active = true;
                }
View Full Code Here

        // Configure the pipeline factory.
        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

      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(new SimpleChannelUpstreamHandler());
      }
    });
    final ChannelFuture future = clientBootstrap.connect(serverAddress);
    future.awaitUninterruptibly();

    final Channel channel = future.getChannel();

    final StringBuilder payload = new StringBuilder();
    for (int i = 0; i < payloadSize; i++) {
View Full Code Here

    });

    // Start the connection attempt.
    final ChannelFuture future = bootstrap.connect(new InetSocketAddress(ip, port));

    future.awaitUninterruptibly();

    afterConnect(serverSocket, future);

    // Wait until the connection is closed or the connection attempt fails.
    future.getChannel().getCloseFuture().awaitUninterruptibly();
View Full Code Here

    }

    @Override
    protected Channel _connect(InetSocketAddress address) {
        ChannelFuture future = bootstrap.connect(address);
        Channel channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess()) {
            logger.error("connect failed!", future.getCause());
            return null;
        } else {
            return channel;
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.