Package io.netty.channel

Examples of io.netty.channel.ChannelFuture.awaitUninterruptibly()


            // set the pipeline factory, which creates the pipeline for each newly created channels
            connectionlessClientBootstrap.handler(pipelineFactory);
            // bind and store channel so we can close it when stopping
            answer = connectionlessClientBootstrap.bind(new InetSocketAddress(0));
            answer.awaitUninterruptibly();
            Channel channel = answer.channel();
            allChannels.add(channel);
            // if udp connectionless sending is true we don't do a connect.
            // we just send on the channel created with bind which means
            // really fire and forget. You wont get an PortUnreachableException
View Full Code Here


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

      future.awaitUninterruptibly();

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

            log.warn("createChannel: try to lock channel table, but timeout, {}ms", LockTimeoutMillis);
        }

        if (cw != null) {
            ChannelFuture channelFuture = cw.getChannelFuture();
            if (channelFuture.awaitUninterruptibly(this.nettyClientConfig.getConnectTimeoutMillis())) {
                if (cw.isOK()) {
                    log.info("createChannel: connect remote host[{}] success, {}", addr,
                        channelFuture.toString());
                    return cw.getChannel();
                }
View Full Code Here

    @Override
    protected void doResume() throws Exception {
        if (channel != null) {
            LOG.debug("ServerBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
            ChannelFuture future = channel.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
            future.awaitUninterruptibly();
            if (!future.isSuccess()) {
                // if we cannot bind, the re-create channel
                allChannels.remove(channel);
                future = serverBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
                future.awaitUninterruptibly();
View Full Code Here

            future.awaitUninterruptibly();
            if (!future.isSuccess()) {
                // if we cannot bind, the re-create channel
                allChannels.remove(channel);
                future = serverBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
                future.awaitUninterruptibly();
                channel = future.channel();
                allChannels.add(channel);
            }
        }
    }
View Full Code Here

    protected void doSuspend() throws Exception {
        if (channel != null) {
            LOG.debug("ServerBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());
            //TODO need to check if it's good way to unbinding the channel
            ChannelFuture future = channel.close();
            future.awaitUninterruptibly();
        }
    }

    protected void startServerBootstrap() {
        // prefer using explicit configured thread pools
View Full Code Here

        LOG.debug("Created ServerBootstrap {}", serverBootstrap);

        LOG.info("ServerBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
        ChannelFuture channelFutrue = serverBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
        channelFutrue.awaitUninterruptibly();
        channel = channelFutrue.channel();
        // to keep track of all channels in use
        allChannels.add(channel);
    }
View Full Code Here

        InetSocketAddress hostAddress = new InetSocketAddress(configuration.getHost(), configuration.getPort());
        SubnetUtils multicastSubnet = new SubnetUtils(MULTICAST_SUBNET);

        if (multicastSubnet.getInfo().isInRange(configuration.getHost())) {
            ChannelFuture channelFuture = bootstrap.bind(hostAddress);
            channelFuture.awaitUninterruptibly();
            channel = channelFuture.channel();
            DatagramChannel datagramChannel = (DatagramChannel) channel;
            String networkInterface = configuration.getNetworkInterface() == null ? LOOPBACK_INTERFACE : configuration.getNetworkInterface();
            multicastNetworkInterface = NetworkInterface.getByName(networkInterface);
            ObjectHelper.notNull(multicastNetworkInterface, "No network interface found for '" + networkInterface + "'.");
View Full Code Here

            datagramChannel.joinGroup(hostAddress, multicastNetworkInterface).syncUninterruptibly();
            allChannels.add(datagramChannel);
        } else {
            LOG.info("ConnectionlessBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
            ChannelFuture channelFuture = bootstrap.bind(hostAddress);
            channelFuture.awaitUninterruptibly();
            channel = channelFuture.channel();
            allChannels.add(channel);
        }
    }
View Full Code Here

            // set the pipeline factory, which creates the pipeline for each newly created channels
            connectionlessClientBootstrap.handler(pipelineFactory);
            // bind and store channel so we can close it when stopping
            ChannelFuture channelFuture = connectionlessClientBootstrap.bind(new InetSocketAddress(0));
            channelFuture.awaitUninterruptibly();
            Channel channel = channelFuture.channel();
            allChannels.add(channel);
            answer = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort()));

            if (LOG.isDebugEnabled()) {
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.