Package org.jboss.netty.channel

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


            bootstrap.setOption("connectTimeoutMillis", connectTimeout.toMillis());
        }

        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here


        ClientBootstrap bootstrap = createClientBootstrap(socksProxyAddress);
        bootstrap.setOptions(configBuilder.getOptions());
        bootstrap.setOption("connectTimeoutMillis", (long) connectTimeout.toMillis());
        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here

        if (!isPersistentConnection)
        {
            try
            {
                future.await().addListener(ChannelFutureListener.CLOSE);
            } catch (InterruptedException e)
            {
                // TODO: Create specific exception?
                throw new RuntimeException(
                        "Waiting for channel to be done to close it failed.", e);
View Full Code Here

  public void connect(long timeout, TimeUnit unit) throws Exception {
    bootstrap.setOption("connectTimeoutMillis",
        TimeUnit.MILLISECONDS.convert(timeout, unit));
    ChannelFuture cf = bootstrap.connect(new InetSocketAddress(host, port));
    cf.await();
    if (!cf.isSuccess()) {
      throw (Exception) cf.getCause();
    }
    channel = cf.getChannel();
  }
View Full Code Here

        bootstrap.setPipeline(Channels.pipeline(new ObjectDecoder(MessagingServer.getMaxObjectSize()), new ObjectEncoder(), messagingClientHandler));
    }
   
    public void connect() throws Exception {
        ChannelFuture future = bootstrap.connect(masterAddr);
        future.await();
        if (!future.isSuccess()) {
            throw (Exception)future.getCause();
        }
        channel = future.getChannel();
    }
View Full Code Here

            {
               while (true)
               {
                  try
                  {
                     boolean ok = future.await(10000);

                     if (!ok)
                     {
                        HornetQLogger.LOGGER.timeoutFlushingPacket();
                     }
View Full Code Here

        ClientBootstrap bootstrap = createClientBootstrap(socksProxyAddress);
        bootstrap.setOptions(configBuilder.getOptions());
        bootstrap.setOption("connectTimeoutMillis", (long) connectTimeout.toMillis());
        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here

        ClientBootstrap bootstrap = createClientBootstrap(socksProxyAddress);
        bootstrap.setOptions(configBuilder.getOptions());
        bootstrap.setOption("connectTimeoutMillis", (long) connectTimeout.toMillis());
        bootstrap.setPipelineFactory(new NiftyClientChannelPipelineFactory(maxFrameSize));
        ChannelFuture f = bootstrap.connect(addr);
        f.await();
        Channel channel = f.getChannel();
        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
View Full Code Here

        // attempt to connect to the remote system
        ChannelFuture connectFuture = this.clientBootstrap.connect(socketAddr);
       
        // wait until the connection is made successfully
        boolean timeout = !connectFuture.await(connectTimeoutMillis);

        if (timeout) {
            throw new SmppChannelConnectTimeoutException("Unable to connect to host [" + host + "] and port [" + port + "] within " + connectTimeoutMillis + " ms");
        }
View Full Code Here

        int timeout = 0;
        try {
            ChannelFuture future = channel.write(message);
            if (sent) {
                timeout = getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
                success = future.await(timeout);
            }
            Throwable cause = future.getCause();
            if (cause != null) {
                throw cause;
            }
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.