Package org.jboss.netty.channel.socket.nio

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


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

   * @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

    }   
    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

        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

    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

    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

                        .withWorkerCount(configuration.getWorkerCount())
                        .withName("NettyClientTCPWorker")
                        .build();
                wp = workerPool;
            }
            channelFactory = new NioClientSocketChannelFactory(bp, wp);
        }
    }
View Full Code Here

 
  public static void main(String[] args) throws UnknownHostException
  {
    String host = "localhost";
    int port = 18090;
    ChannelFactory factory = new NioClientSocketChannelFactory(Executors
        .newCachedThreadPool(), Executors.newCachedThreadPool());
    final DefenderHandler defHandler = new DefenderHandler();
    PipelineFactory defFactory = new PipelineFactory(defHandler);
    final ZombieHandler zomHandler = new ZombieHandler();
    PipelineFactory zomFactory = new PipelineFactory(zomHandler);
View Full Code Here

    }
   

    public void httptest(String fileName) {
  ClientBootstrap client = new ClientBootstrap(
                 new NioClientSocketChannelFactory(
                           Executors.newCachedThreadPool(),
                           Executors.newCachedThreadPool()));

  client.setPipelineFactory(new ClientPipelineFactory());
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory

Copyright © 2018 www.massapicom. 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.