Examples of awaitUninterruptibly()


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

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

        // Wait until the connection attempt succeeds or fails.
        Channel channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess()) {
            future.getCause().printStackTrace();
            bootstrap.releaseExternalResources();
            return;
        }
View Full Code Here

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

});
   
     // Start the connection attempt.
    ChannelFuture future = bootstrap.connect(new InetSocketAddress("localhost", 8080));
    // Wait until the connection attempt succeeds or fails.
    Channel channel = future.awaitUninterruptibly().getChannel();
    if (future.isSuccess())
      System.out.println("connected");
   
    // get a proxy
View Full Code Here

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

                        System.out.println("reconnecting...");
                         ChannelFuture f = _bootstrap.connect();
                         try
              {
                           System.out.println("future wait");
                f.awaitUninterruptibly();
                         System.out.println("future wait terminated");
              }
              catch (Exception e)
              {
                // TODO Auto-generated catch block
View Full Code Here

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

              public void run() {
                Constants.ahessianLogger.warn("reconnecting...");
                  ChannelFuture f = _bootstrap.getBootstrap().connect();
                  try
        {
          f.awaitUninterruptibly();
        }
        catch (Exception e)
        {
          // TODO Auto-generated catch block
          Constants.ahessianLogger.warn("", e);
View Full Code Here

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

                // Ignore
            }
        } while (future == null);

        // Wait for the future.
        future.awaitUninterruptibly();
        if (!future.isSuccess()) {
            future.getChannel().close().awaitUninterruptibly();
            throw new ChannelException("Failed to bind to: " + localAddress, future.getCause());
        }
View Full Code Here

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

          @Override
          public void run()
          {
            //System.err.println("Client running on thread: " + Thread.currentThread());
            ChannelFuture connectFuture = _clientBootstrap.connect(new LocalAddress(serverAddr));
            connectFuture.awaitUninterruptibly();
            _channel = connectFuture.getChannel();
            _lock.lock();
            try
            {
              _connected = connectFuture.isSuccess();
View Full Code Here

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

    {
      _lock.unlock();
    }

    ChannelFuture closeFuture = _channel.close();
    closeFuture.awaitUninterruptibly();
    _clientBootstrap.releaseExternalResources();
  }

  public Channel getChannel()
  {
View Full Code Here

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

    {
      _lock.unlock();
    }

    ChannelFuture closeFuture = _channel.close();
    closeFuture.awaitUninterruptibly();
    _srvBootstrap.releaseExternalResources();
  }

  public Channel getChannel()
  {
View Full Code Here

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

    String uristr = "/stream?sources=105&output=json&size=" + fetchSize + "&streamFromLatestScn=false&checkPoint=" + ckpt.toString();
    ClientBootstrap bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                                      Executors.newCachedThreadPool()));
    bootstrap.setPipelineFactory(new HttpClientPipelineFactory(handler));
    ChannelFuture future = bootstrap.connect(new InetSocketAddress("localhost", relayPort));
    Channel channel = future.awaitUninterruptibly().getChannel();
    Assert.assertTrue(future.isSuccess(), "Cannot connect to relay at localhost:" + relayPort);
    HttpRequest request  = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uristr);
    request.setHeader(HttpHeaders.Names.HOST, "localhost");
    channel.write(request);
    channel.getCloseFuture().awaitUninterruptibly();
View Full Code Here

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

    HashMap<String, String> headers = new HashMap<String, String>();
    HashMap<String, String> footers = new HashMap<String, String>();
    setupServer(HttpResponseStatus.OK,chunks, headers, footers);

    ChannelFuture connectFuture = _clientBootstrap.connect(_serverAddress);
    connectFuture.awaitUninterruptibly(1, TimeUnit.SECONDS);
    assertTrue("connect succeeded", connectFuture.isSuccess());

    HttpRequest request = new DefaultHttpRequest(HTTP_1_1, HttpMethod.GET, "/test");
    Channel requestChannel = connectFuture.getChannel();
    ChannelFuture writeFuture = requestChannel.write(request);
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.