Examples of NioClientSocketChannelFactory


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

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

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

 
  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

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

    }
   

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

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

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

    }

    public void initcassandradb() {
  ClientBootstrap client = new ClientBootstrap(
                 new NioClientSocketChannelFactory(
                           Executors.newCachedThreadPool(),
                           Executors.newCachedThreadPool()));

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

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

   }

   private void init() {
      // Configure the client.
      ClientBootstrap bootstrap = new ClientBootstrap(
            new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));

      // Set up the event pipeline factory.
      bootstrap.setPipelineFactory(new HotrodClientPipelaneFactory(decoder));

      // Start the connection attempt.
View Full Code Here

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

        //each context will have a single client channel factory
        int maxWorkers = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_CLIENT_WORKER_THREADS));
    ThreadFactory bossFactory = new NettyRenameThreadFactory("client" + "-boss");
        ThreadFactory workerFactory = new NettyRenameThreadFactory("client" + "-worker");
        if (maxWorkers > 0) {
            clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory),
                    Executors.newCachedThreadPool(workerFactory), maxWorkers);
        } else {
            clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory),
                    Executors.newCachedThreadPool(workerFactory));
        }
       
        int otherWorkers = Utils.getInt(storm_conf.get(Config.TOPOLOGY_WORKERS), 1) - 1;
        int poolSize = Math.min(Math.max(1, otherWorkers), MAX_CLIENT_SCHEDULER_THREAD_POOL_SIZE);
View Full Code Here

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

    logger.info("Callback pool created");
    if(!isTimeoutTest) {
      client = new HBaseClient(zkQuorum, zkBaseDir, sinkCallbackPool);
    } else {
      client = new HBaseClient(zkQuorum, zkBaseDir,
        new NioClientSocketChannelFactory(Executors
          .newSingleThreadExecutor(),
          Executors.newSingleThreadExecutor()));
    }
    final CountDownLatch latch = new CountDownLatch(1);
    final AtomicBoolean fail = new AtomicBoolean(false);
View Full Code Here

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

   @Override
   public void start(CoprocessorEnvironment e) throws IOException {
      System.out.println("Starting compacter");
      Configuration conf = e.getConfiguration();
      factory = new NioClientSocketChannelFactory(bossExecutor, workerExecutor, 3);
      bootstrap = new ClientBootstrap(factory);

      bootstrap.getPipeline().addLast("decoder", new ObjectDecoder());
      bootstrap.getPipeline().addLast("handler", new Handler());
      bootstrap.setOption("tcpNoDelay", false);
View Full Code Here

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

      channel = null;
     
      System.out.println("Starting TSOClient");

      // Start client with Nb of active threads = 3 as maximum.
      factory = new NioClientSocketChannelFactory(Executors
                                                  .newCachedThreadPool(), Executors.newCachedThreadPool(), 3);
      // Create the bootstrap
      bootstrap = new ClientBootstrap(factory);
     
      int executorThreads = conf.getInt("tso.executor.threads", 3);
View Full Code Here

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

        }

        // *** Start the Netty configuration ***

        // Start client with Nb of active threads = 3 as maximum.
        ChannelFactory factory = new NioClientSocketChannelFactory(Executors
                .newCachedThreadPool(), Executors.newCachedThreadPool(), 30);

        // Create the global ChannelGroup
        ChannelGroup channelGroup = new DefaultChannelGroup(
                TransactionClient.class.getName());
       
        List<ClientHandler> handlers = new ArrayList<ClientHandler>();

        Configuration conf = HBaseConfiguration.create();
        conf.set("tso.host", host);
        conf.setInt("tso.port", port);
        conf.setInt("tso.executor.threads", 10);

        for(int i = 0; i < runs; ++i) {
         // Create the associated Handler
           ClientHandler handler = new ClientHandler(conf, nbMessage, inflight, pauseClient, percentRead);
  
           // *** Start the Netty running ***
  
           System.out.println("PARAM MAX_ROW: " + ClientHandler.MAX_ROW);
           System.out.println("PARAM DB_SIZE: " + ClientHandler.DB_SIZE);
           System.out.println("pause " + pauseClient);
           System.out.println("readPercent " + percentRead);
  
           handlers.add(handler);
          
           if ((i - 1) % 20 == 0) Thread.sleep(1000);
        }
       
        // Wait for the Traffic to finish
        for (ClientHandler handler : handlers) {
           boolean result = handler.waitForAll();
           System.out.println("Result: " + result);
        }

        // *** Start the Netty shutdown ***

        // Now close all channels
        System.out.println("close channelGroup");
        channelGroup.close().awaitUninterruptibly();
        // Now release resources
        System.out.println("close external resources");
        factory.releaseExternalResources();
    }
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.