Examples of NioClientSocketChannelFactory


Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

  private void connect(long timeout, TimeUnit tu) throws FlumeException {
    callTimeoutPool = Executors.newCachedThreadPool(
        new TransceiverThreadFactory("Flume Avro RPC Client Call Invoker"));
    try {
      transceiver = new NettyTransceiver(this.address,
          new NioClientSocketChannelFactory(
        Executors.newCachedThreadPool(new TransceiverThreadFactory(
            "Avro " + NettyTransceiver.class.getSimpleName() + " Boss")),
        Executors.newCachedThreadPool(new TransceiverThreadFactory(
            "Avro " + NettyTransceiver.class.getSimpleName() + " I/O Worker"))),
          tu.toMillis(timeout));
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

    /**
     * {@inheritedDoc}
     */
    public void start(final int port, final CountDownLatch counter, final byte[] data) throws IOException {
        factory = new NioClientSocketChannelFactory();
        ClientBootstrap bootstrap = new ClientBootstrap(factory);
        bootstrap.setOption("sendBufferSize", 64 * 1024);
        bootstrap.setOption("tcpNoDelay", true);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

  {
    Checkpoint ckpt = Checkpoint.createOnlineConsumptionCheckpoint(scn);
    //TODO why is this needed
    //ckpt.setCatchupSource("foo");
    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);
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

      {
        _bossThreadPool = Executors.newCachedThreadPool(new NamedThreadFactory("boss"));;
        _ioThreadPool = Executors.newCachedThreadPool(new NamedThreadFactory("io"));;
        _timeoutTimer = new HashedWheelTimer(5, TimeUnit.MILLISECONDS);
        _clientConfig = clientConfig;
        _channelFactory = new NioClientSocketChannelFactory(_bossThreadPool, _ioThreadPool);
        _channelGroup = new DefaultChannelGroup();;
      }
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

    _timeoutTimer = timeoutTimer;
    _writeTimeoutMs = writeTimeoutMs;
    _readTimeoutMs = readTimeoutMs;
    _bstReadTimeoutMs = bstReadTimeoutMs;
    _protocolVersion = protocolVersion;
    _channelFactory = new NioClientSocketChannelFactory(_bossThreadPool, _ioThreadPool);
    _channelGroup = channelGroup;
    _maxEventVersion = maxEventVersion;
  }
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

   * @throws FlumeException
   */
  private void connect(long timeout, TimeUnit tu) throws FlumeException {
    callTimeoutPool = Executors.newCachedThreadPool(
        new TransceiverThreadFactory("Flume Avro RPC Client Call Invoker"));
    NioClientSocketChannelFactory socketChannelFactory = null;

    try {

      ExecutorService bossExecutor =
        Executors.newCachedThreadPool(new TransceiverThreadFactory(
          "Avro " + NettyTransceiver.class.getSimpleName() + " Boss"));
      ExecutorService workerExecutor =
        Executors.newCachedThreadPool(new TransceiverThreadFactory(
          "Avro " + NettyTransceiver.class.getSimpleName() + " I/O Worker"));

      if (enableDeflateCompression || enableSsl) {
        if (maxIoWorkers >= 1) {
          socketChannelFactory = new SSLCompressionChannelFactory(
            bossExecutor, workerExecutor,
            enableDeflateCompression, enableSsl, trustAllCerts,
            compressionLevel, truststore, truststorePassword, truststoreType,
            excludeProtocols, maxIoWorkers);
        } else {
          socketChannelFactory = new SSLCompressionChannelFactory(
            bossExecutor, workerExecutor,
            enableDeflateCompression, enableSsl, trustAllCerts,
            compressionLevel, truststore, truststorePassword, truststoreType,
            excludeProtocols);
        }
      } else {
        if (maxIoWorkers >= 1) {
          socketChannelFactory = new NioClientSocketChannelFactory(
              bossExecutor, workerExecutor, maxIoWorkers);
        } else {
          socketChannelFactory = new NioClientSocketChannelFactory(
              bossExecutor, workerExecutor);
        }
      }

      transceiver = new NettyTransceiver(this.address,
          socketChannelFactory,
          tu.toMillis(timeout));
      avroClient =
          SpecificRequestor.getClient(AvroSourceProtocol.Callback.class,
          transceiver);
    } catch (Throwable t) {
      if (callTimeoutPool != null) {
        callTimeoutPool.shutdownNow();
      }
      if (socketChannelFactory != null) {
        socketChannelFactory.releaseExternalResources();
      }
      if (t instanceof IOException) {
        throw new FlumeException(this + ": RPC connection error", t);
      } else if (t instanceof FlumeException) {
        throw (FlumeException) t;
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

    }   
    bossThreadFactory = new ExecutorThreadFactory("ClientBossPool", true);
    workerThreadFactory = new ExecutorThreadFactory("ClientWorkerPool", true);
    bossPool = Executors.newCachedThreadPool(bossThreadFactory);
    workerPool = Executors.newCachedThreadPool(workerThreadFactory);
    channelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
    pipelineFactory = new ChannelPipelineFactoryImpl(providers);
    bootstrap = new ClientBootstrap(channelFactory);
    bootstrap.setOptions(channelOptions);
    bootstrap.setPipelineFactory(pipelineFactory);
 
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

        logger.info("Connecting to {}", server);
        this.server = server;
        PeerInfo client = new PeerInfo("clientHostname", 9999);
        bootstrap = new DuplexTcpClientBootstrap(
                client,
                new NioClientSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool()));
        bootstrap.setCompression(false);

        bootstrap.setOption("connectTimeoutMillis", 1000);
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

    bootServer();
    clog("DateSender Example");
    try {
      Executor bossPool = Executors.newCachedThreadPool();
      Executor workerPool = Executors.newCachedThreadPool();
      final ChannelFactory channelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
      ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
          return Channels.pipeline(
            new ObjectEncoder()
          );
View Full Code Here

Examples of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

    bootServer();
    clog("DateModifier Example");
    try {
      Executor bossPool = Executors.newCachedThreadPool();
      Executor workerPool = Executors.newCachedThreadPool();
      final ChannelFactory channelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
      ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
          return Channels.pipeline(
            new ObjectEncoder(),
            new ObjectDecoder(ClassResolvers.cacheDisabled(getClass().getClassLoader())),
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.