Package org.jboss.netty.bootstrap

Examples of org.jboss.netty.bootstrap.ClientBootstrap.releaseExternalResources()


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

          // Prepare the ICAP request.
          IcapRequest request = new DefaultIcapRequest(IcapVersion.ICAP_1_0,IcapMethod.REQMOD,"/simple","localhost");    
View Full Code Here


          // Wait for the server to close the connection.
          channel.getCloseFuture().awaitUninterruptibly();

          // Shut down executor threads to exit.
          bootstrap.releaseExternalResources();
  }
}
View Full Code Here

            }
        });

        ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));
        future.getChannel().getCloseFuture().awaitUninterruptibly();
        bootstrap.releaseExternalResources();
        _logger.info("closed");
    }

    public class ObjectClientHandler extends SimpleChannelUpstreamHandler
    {
View Full Code Here

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

        // Shut down thread pools to exit.
        bootstrap.releaseExternalResources();
    }

    public static void main(String[] args) throws Exception {
        // Print usage if no argument is specified.
        if (args.length < 2 || args.length > 3) {
View Full Code Here

        clientBootstrap.setPipelineFactory(new HttpClientPipelineFactory(tmpFile));
        ChannelFuture channelFuture = clientBootstrap.connect(new InetSocketAddress(host, port));
        // TODO timeout?
        Channel channel = channelFuture.awaitUninterruptibly().getChannel();
        if (!channelFuture.isSuccess()) {
            clientBootstrap.releaseExternalResources();
            throw new ArchiveFetchException("Cannot connect to http uri [" + uri.toString() + "]",
                    channelFuture.getCause());
        }

        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri.getPath());
View Full Code Here

        channel.write(request);

        channel.getCloseFuture().awaitUninterruptibly();

        clientBootstrap.releaseExternalResources();

        logger.debug("Finished downloading archive file through http {}, as file: {}", uri.toString(),
                tmpFile.getAbsolutePath());
        try {
            return new FileInputStream(tmpFile);
View Full Code Here

      }
     
      // Wait for all connections to complete their tasks.
      channelPipelineFactory.getCountDownLatch().await();
      // Shut down executor threads to exit.
      clientBootstrap.releaseExternalResources();
    } catch (InterruptedException e) {
      throw new BenchmarkException(e);
    }
  }
 
View Full Code Here

        long end = System.currentTimeMillis();
        long seconds = (end - start) / 1000;
        System.out.println("Ran [" + NUMBER_OF_ITERATIONS + "] iterations, payload [" + payloadSize + "]: took [" + seconds + "], TPS: " + ((double) NUMBER_OF_ITERATIONS) / seconds);

        clientChannel.close().awaitUninterruptibly();
        clientBootstrap.releaseExternalResources();
        serverBootstrap.releaseExternalResources();
    }

    public static class EchoClientHandler extends SimpleChannelUpstreamHandler {
View Full Code Here

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

        // Shut down thread pools to exit.
        bootstrap.releaseExternalResources();   
  }
 
  /**
   * Do whatever client want to do with resolved data
   * @param packet
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.