Package org.jboss.netty.channel

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


    ChannelFuture closeFuture = childChannel.close();
    if (timeoutMillis > 0)
    {
      try
      {
        closeFuture.await(timeoutMillis);
      }
      catch (InterruptedException e)
      {
        //NOOP
      }
View Full Code Here


    try
    {
        setListeners(responseHandler,respProcessor,requestListener,closeListener);
        ChannelFuture writeFuture = channel.write(new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                                                                         HttpMethod.GET, "/test"));
        Assert.assertTrue(writeFuture.await(1000));

        //It seems that there is a race condition between the writeFuture succeeding
        //and the writeComplete message getting to the handler. Make sure that the
        //writeComplete has got to the handler before we do anything else with
        //the channel.
View Full Code Here

    ChannelFuture writeFuture = childChannel.write(response);
    if (timeoutMillis > 0)
    {
      try
      {
        writeFuture.await(timeoutMillis);
      }
      catch (InterruptedException e)
      {
        //NOOP
      }
View Full Code Here

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

                     if (!ok)
                     {
                        NettyConnection.log.warn("Timed out waiting for packet to be flushed");
                     }
View Full Code Here

        }

        try {
            ChannelFuture connectFuture = this.bootstrap.connect(new InetSocketAddress(clusterNode.getMachineName(),
                    clusterNode.getPort()));
            connectFuture.await();
            if (connectFuture.isSuccess()) {
                channels.add(connectFuture.getChannel());
                partitionChannelMap.forcePut(partitionId, connectFuture.getChannel());
                return true;
            }
View Full Code Here

    ChannelFuture closeFuture = childChannel.close();
    if (timeoutMillis > 0)
    {
      try
      {
        closeFuture.await(timeoutMillis);
      }
      catch (InterruptedException e)
      {
        //NOOP
      }
View Full Code Here

    //send a request
    ChannelBuffer msg = ChannelBuffers.wrappedBuffer("hello".getBytes(Charset.defaultCharset()));
    ChannelFuture writeFuture = clientConn.getChannel().write(msg);

    //wait for the request to propagate
    try {writeFuture.await(10);} catch (InterruptedException ie){};
    Assert.assertTrue(writeFuture.isDone(), "write completed");
    Assert.assertTrue(writeFuture.isSuccess(), "write successful");

    Assert.assertNull(srvExceptionListener.getLastException(), "no server read timeout");
    Assert.assertNull(clientExceptionListener.getLastException(), "no client read timeout");
View Full Code Here

    ChannelBuffer msg2 = ChannelBuffers.wrappedBuffer("eom".getBytes(Charset.defaultCharset()));
    writeFuture = clientConn.getChannel().write(msg2);

    //wait for the respomse to propagate
    try {writeFuture.await(10);} catch (InterruptedException ie){};

    //start the client timeout handler
    clientTimeoutHandler.start(clientPipeline.getContext(clientTimeoutHandler));

    Assert.assertTrue(srvExceptionListener.getLastException() instanceof ReadTimeoutException,
View Full Code Here

    ChannelFuture future = request.getResponseContent().getRawChannel().close().awaitUninterruptibly();
   
   
    try {
      future.await();
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
View Full Code Here

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

                  if (!ok)
                  {
                     NettyConnection.log.warn("Timed out waiting for packet to be flushed");
                  }
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.