Package org.jboss.netty.bootstrap

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


        // Print out the answer.
        System.err.format(
                "Factorial of %,d is: %,d", count, handler.getFactorial());

        // Shut down all thread pools to exit.
        bootstrap.releaseExternalResources();
    }
}
View Full Code Here


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

        // Prepare the HTTP request.
        HttpRequest request = new DefaultHttpRequest(
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

  } catch (Exception e) {// Catch exception if any
      System.err.println("Error: " + e.getMessage());
  }
  channel.getCloseFuture().awaitUninterruptibly();

  client.releaseExternalResources();

    }

    public void initcassandradb() {
  ClientBootstrap client = new ClientBootstrap(
View Full Code Here

        buffer.readableBytes());
  request.setContent(buffer);
  channel.write(request).awaitUninterruptibly().getChannel()
      .getCloseFuture().awaitUninterruptibly();

  client.releaseExternalResources();

    }

    private static class TestResponseHandler extends
             SimpleChannelUpstreamHandler {
View Full Code Here

      ChannelFuture future = bootstrap.connect(serverAddress);

      // Wait until the connection attempt succeeds or fails.
      channel = future.awaitUninterruptibly().getChannel();
      if (!future.isSuccess()) {
         bootstrap.releaseExternalResources();
         throw new TransportException("Could not create netty transport", future.getCause());
      }
   }

   @Override
View Full Code Here

      ChannelFuture future = bootstrap.connect(serverAddress);

      // Wait until the connection attempt succeeds or fails.
      channel = future.awaitUninterruptibly().getChannel();
      if (!future.isSuccess()) {
         bootstrap.releaseExternalResources();
         throw new TransportException("Could not create netty transport", future.getCause());
      }
   }

   @Override
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 DeploymentFailedException("Cannot connect to http uri [" + uri.toString() + "]",
                    channelFuture.getCause());
        }

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

        channel.write(request);

        channel.getCloseFuture().awaitUninterruptibly();

        clientBootstrap.releaseExternalResources();

        logger.debug("Finished downloading s4r file through http {}", uri.toString());
        try {
            return new FileInputStream(tmpFile);
        } catch (FileNotFoundException e) {
View Full Code Here

    ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));

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

    String query = uri.getPath()
        + (uri.getRawQuery() != null ? "?" + uri.getRawQuery() : "");
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.