Package org.jboss.netty.bootstrap

Examples of org.jboss.netty.bootstrap.ServerBootstrap


  }
 
  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;
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));
      this.bootstraps.add(bootstrap);
      System.out.println("SSL listening on port: " + this.sslPort);
    }
   
    //add the flashsocket policy server, if needed
View Full Code Here

                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 {
            serverBootstrap.setPipelineFactory(new DefaultServerPipelineFactory(this));
View Full Code Here

  // TODO change AbstractService to throw InterruptedException
  @Override
  public synchronized void start() {
    Configuration conf = getConfig();
    ServerBootstrap bootstrap = new ServerBootstrap(selector);
    try {
      pipelineFact = new HttpPipelineFactory(conf);
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
    bootstrap.setPipelineFactory(pipelineFact);
    port = conf.getInt(SHUFFLE_PORT_CONFIG_KEY, DEFAULT_SHUFFLE_PORT);
    Channel ch = bootstrap.bind(new InetSocketAddress(port));
    accepted.add(ch);
    port = ((InetSocketAddress)ch.getLocalAddress()).getPort();
    conf.set(SHUFFLE_PORT_CONFIG_KEY, Integer.toString(port));
    pipelineFact.SHUFFLE.setPort(port);
    LOG.info(getName() + " listening on port " + port);
View Full Code Here

  }

  @Override
  public synchronized void stop() {
    accepted.close().awaitUninterruptibly(10, TimeUnit.SECONDS);
    ServerBootstrap bootstrap = new ServerBootstrap(selector);
    bootstrap.releaseExternalResources();
    pipelineFact.destroy();
    super.stop();
  }
View Full Code Here

    channelFactory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors
        .newCachedThreadPool());

    allChannels = new DefaultChannelGroup("jmemcachedChannelGroup");

    ServerBootstrap bootstrap = new ServerBootstrap(channelFactory);

    ChannelPipelineFactory pipelineFactory;
    if (binary)
      pipelineFactory = createMemcachedBinaryPipelineFactory(cache, memcachedVersion, verbose, idleTime,
          allChannels);
    else
      pipelineFactory = createMemcachedPipelineFactory(cache, memcachedVersion, verbose, idleTime, frameSize,
          allChannels);

    bootstrap.setOption("child.tcpNoDelay", true);
    bootstrap.setOption("child.keepAlive", true);
    bootstrap.setOption("child.receiveBufferSize", 1024 * 64);
    bootstrap.setPipelineFactory(pipelineFactory);

    Channel serverChannel = bootstrap.bind(addr);
    allChannels.add(serverChannel);

    log.info("Listening on " + String.valueOf(addr.getHostName()) + ":" + addr.getPort());

    running = true;
View Full Code Here

 
  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 {
        ChannelPipeline p = Channels.pipeline();
        p.addLast("frameDecoder", new NettyFrameDecoder());
        p.addLast("frameEncoder", new NettyFrameEncoder());
        p.addLast("handler", new NettyServerAvroHandler());
        return p;
      }
    });
    serverChannel = bootstrap.bind(addr);
    allChannels.add(serverChannel);
  }
View Full Code Here

            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);
            serverBootstrap.setPipelineFactory(configuration.getServerPipelineFactory());
        } else {
            serverBootstrap.setPipelineFactory(new DefaultServerPipelineFactory(this));
View Full Code Here

  // TODO change AbstractService to throw InterruptedException
  @Override
  public synchronized void start() {
    Configuration conf = getConfig();
    ServerBootstrap bootstrap = new ServerBootstrap(selector);

    try {
      pipelineFact = new HttpPipelineFactory(conf);
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
    bootstrap.setPipelineFactory(pipelineFact);
    port = conf.getInt(ConfVars.PULLSERVER_PORT.varname,
        ConfVars.PULLSERVER_PORT.defaultIntVal);
    Channel ch = bootstrap.bind(new InetSocketAddress(port));
    accepted.add(ch);
    port = ((InetSocketAddress)ch.getLocalAddress()).getPort();
    conf.set(ConfVars.PULLSERVER_PORT.varname, Integer.toString(port));
    pipelineFact.PullServer.setPort(port);
    LOG.info(getName() + " listening on port " + port);
View Full Code Here

  @Override
  public synchronized void stop() {
    try {
      accepted.close().awaitUninterruptibly(10, TimeUnit.SECONDS);
      ServerBootstrap bootstrap = new ServerBootstrap(selector);
      bootstrap.releaseExternalResources();
      pipelineFact.destroy();

      localFS.close();
    } catch (Throwable t) {
      LOG.error(t);
View Full Code Here

TOP

Related Classes of org.jboss.netty.bootstrap.ServerBootstrap

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.