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

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


    public synchronized void bind() throws Exception {
        if (started) throw new IllegalStateException("Server running already");

        if (port < 1) throw new RuntimeException("Please specify a port to which the server should get bound!");

        bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(createBossExecutor(), createWorkerExecutor(), ioWorker));
        ChannelPipelineFactory factory = createPipelineFactory(channels);
       
        // Configure the pipeline factory.
        bootstrap.setPipelineFactory(factory);
View Full Code Here


        ThreadFactory bossFactory = new NettyRenameThreadFactory(name() + "-boss");
        ThreadFactory workerFactory = new NettyRenameThreadFactory(name() + "-worker");
       
        if (maxWorkers > 0) {
            factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(bossFactory),
                Executors.newCachedThreadPool(workerFactory), maxWorkers);
        } else {
            factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(bossFactory),
                Executors.newCachedThreadPool(workerFactory));
        }
       
        LOG.info("Create Netty Server " + name() + ", buffer_size: " + buffer_size + ", maxWorkers: " + maxWorkers);
       
View Full Code Here

 
  protected void init(DynMap config, Executor bossExecutor, Executor workerExecutor) {
     // Configure HTTP Ping server.
   
        this.bootstrap = new ServerBootstrap(
                new NioServerSocketChannelFactory(
                    bossExecutor,
                    workerExecutor));

        final DynMap cfg = config;
        // Set up the event pipeline factory.
View Full Code Here

  public void start() {
     // Configure the server(s).
    if (this.port != null) {
     
      ServerBootstrap  bootstrap = new ServerBootstrap(
                  new NioServerSocketChannelFactory(
                          this.bossExecutor,
                          this.workerExecutor));
          // Set up the event pipeline factory.
          bootstrap.setPipelineFactory(new StrestServerPipelineFactory(router, null));
      bootstrap.bind(new InetSocketAddress(this.port));
      this.bootstraps.add(bootstrap);
      System.out.println("Listening on port: " + this.port);
    }
    if (this.sslPort != null && this.sslContext != null) {
     
      ServerBootstrap  bootstrap = new ServerBootstrap(
                  new NioServerSocketChannelFactory(
                          this.bossExecutor,
                          this.workerExecutor));
          // Set up the event pipeline factory.
          bootstrap.setPipelineFactory(new StrestServerPipelineFactory(router, sslContext));
      bootstrap.bind(new InetSocketAddress(this.sslPort));
View Full Code Here

        ExecutorService bossExecutor = context.getExecutorServiceStrategy().newThreadPool(this, "NettyTCPBoss",
                configuration.getCorePoolSize(), configuration.getMaxPoolSize());
        ExecutorService workerExecutor = context.getExecutorServiceStrategy().newThreadPool(this, "NettyTCPWorker",
                configuration.getCorePoolSize(), configuration.getMaxPoolSize());

        channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
        serverBootstrap = new ServerBootstrap(channelFactory);
        if (configuration.getServerPipelineFactory() != null) {
            configuration.getServerPipelineFactory().setConsumer(this);
            serverBootstrap.setPipelineFactory(configuration.getServerPipelineFactory());
        } else {
View Full Code Here

      .build();
    ThreadFactory workerFactory = new ThreadFactoryBuilder()
      .setNameFormat("ShuffleHandler Netty Worker #%d")
      .build();
   
    selector = new NioServerSocketChannelFactory(
        Executors.newCachedThreadPool(bossFactory),
        Executors.newCachedThreadPool(workerFactory));
    super.init(new Configuration(conf));
  }
View Full Code Here

  /**
   * Bind the network connection and start the network processing threads.
   */
  public void start() {
    // TODO provide tweakable options here for passing in custom executors.
    channelFactory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors
        .newCachedThreadPool());

    allChannels = new DefaultChannelGroup("jmemcachedChannelGroup");

    ServerBootstrap bootstrap = new ServerBootstrap(channelFactory);
View Full Code Here

  private ChannelFactory channelFactory;
  private CountDownLatch closed = new CountDownLatch(1);
 
  public NettyServer(Responder responder, InetSocketAddress addr) {
    this.responder = responder;
    channelFactory = new NioServerSocketChannelFactory(Executors
        .newCachedThreadPool(), Executors.newCachedThreadPool());
    ServerBootstrap bootstrap = new ServerBootstrap(channelFactory);
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      @Override
      public ChannelPipeline getPipeline() throws Exception {
View Full Code Here

                configuration.getCorePoolSize(), configuration.getMaxPoolSize());
        ExecutorService workerExecutor = context.getExecutorServiceStrategy().newThreadPool(this, "NettyTCPWorker",
                configuration.getCorePoolSize(), configuration.getMaxPoolSize());

        if (configuration.getWorkerCount() == 0) {
            channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
        } else {
            channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor,
                                                               configuration.getWorkerCount());
        }
        serverBootstrap = new ServerBootstrap(channelFactory);
        if (configuration.getServerPipelineFactory() != null) {
            configuration.getServerPipelineFactory().setConsumer(this);
View Full Code Here

          .build();
      ThreadFactory workerFactory = new ThreadFactoryBuilder()
          .setNameFormat("PullServerAuxService Netty Worker #%d")
          .build();

      selector = new NioServerSocketChannelFactory(
          Executors.newCachedThreadPool(bossFactory),
          Executors.newCachedThreadPool(workerFactory));

      localFS = new LocalFileSystem();
      super.init(new Configuration(conf));
View Full Code Here

TOP

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

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.