Package org.jboss.netty.bootstrap

Examples of org.jboss.netty.bootstrap.ServerBootstrap


                                                         Executors.newCachedThreadPool());
      break;
    }
    default: throw new RuntimeException("unsupported server type: " + serverType );
    }
    _srvBootstrap = new ServerBootstrap(channelFactory);
    _srvBootstrap.setOption("child.bufferFactory",
                            DirectChannelBufferFactory.getInstance(bufferByteOrder));
    _srvBootstrap.setParentHandler(new ChildChannelTracker());
  }
View Full Code Here


    processorRegistry.register(GenerateDataEventsRequestProcessor.COMMAND_NAME,
                               new GenerateDataEventsRequestProcessor(null, _relay,
                                                                      randomEventProducer));

    // Configure the server.
    _bootstrap = new ServerBootstrap(new DefaultLocalServerChannelFactory());
    // Set up the event pipeline factory.
    _bootstrap.setPipelineFactory(new HttpServerPipelineFactory(_relay));
    _serverAddress = new LocalAddress(10);
    _serverChannel = _bootstrap.bind(_serverAddress);
  }
View Full Code Here

      ExecutorService bossExecutor = config.bossExecutor();
      if (bossExecutor == null) { bossExecutor = Executors.newCachedThreadPool(); }
      ExecutorService workerExecutor = config.workerExecutor();
      if (workerExecutor == null) { workerExecutor = Executors.newCachedThreadPool(); }
     
        final ServerBootstrap bootstrap = new ServerBootstrap(
                new NioServerSocketChannelFactory(bossExecutor, workerExecutor));

        bootstrap.setPipelineFactory(pipelineFactory);
        return bootstrap;
    }
View Full Code Here

        return bootstrap;
    }

    private ServerBootstrap buildBootstrapFlashPolicy() {
        // Configure the server.
        final ServerBootstrap bootstrap = new ServerBootstrap(
                new NioServerSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool()));

        // Set up the event pipeline factory.
        bootstrap.setPipelineFactory(new FlashPolicyServerPipelineFactory());
        return bootstrap;
    }
View Full Code Here

    setupServer(requestHandler);
  }

  private void setupServer(DummyHttpRequestHandler requestHandler)
  {
    _serverBootstrap = new ServerBootstrap(new DefaultLocalServerChannelFactory());
    ChannelPipeline serverPipeline = pipeline();
    serverPipeline.addLast("server logger 1", new LoggingHandler("server logger 1", InternalLogLevel.DEBUG, true));
    serverPipeline.addLast("decoder", new HttpRequestDecoder());
    serverPipeline.addLast("encoder", new HttpResponseEncoder());
    serverPipeline.addLast("server loggger 5", new LoggingHandler("server logger 5", InternalLogLevel.DEBUG, true));
View Full Code Here

    }

    @Override
    public void run()
    {
      _bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
          Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));

      // Set up the event pipeline factory.
      _bootstrap.setPipelineFactory(new HttpServerPipelineFactory());
View Full Code Here

  protected void initializeContainerNetworking(ByteOrder byteOrder) throws IOException, DatabusException
  {
    //instruct netty not to rename our threads in the I/O and boss thread pools
    ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.CURRENT);

    _httpBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(_bossExecutorService,
                                                                           _ioExecutorService));
    _httpBootstrap.setPipelineFactory(new HttpServerPipelineFactory(this));
    _httpBootstrap.setOption("bufferFactory", DirectChannelBufferFactory.getInstance(byteOrder));
    _httpBootstrap.setOption("child.bufferFactory", DirectChannelBufferFactory.getInstance(byteOrder));

    if (_containerStaticConfig.getTcp().isEnabled())
    {
      _tcpBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(_bossExecutorService,
                                                                            _ioExecutorService));
      _tcpBootstrap.setPipelineFactory(new TcpServerPipelineFactory(this, byteOrder));
      _tcpBootstrap.setOption("bufferFactory", DirectChannelBufferFactory.getInstance(byteOrder));
      _tcpBootstrap.setOption("child.bufferFactory", DirectChannelBufferFactory.getInstance(byteOrder));
View Full Code Here

  @Override
  public void start() {
    ChannelFactory factory = new NioServerSocketChannelFactory(
        Executors.newCachedThreadPool(), Executors.newCachedThreadPool());

    ServerBootstrap serverBootstrap = new ServerBootstrap(factory);
    serverBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      @Override
      public ChannelPipeline getPipeline() {
        syslogTcpHandler handler = new syslogTcpHandler();
        handler.setEventSize(eventSize);
        handler.setFormater(formaterProp);
        handler.setKeepFields(keepFields);
        return Channels.pipeline(handler);
      }
    });

    logger.info("Syslog TCP Source starting...");

    if (host == null) {
      nettyChannel = serverBootstrap.bind(new InetSocketAddress(port));
    } else {
      nettyChannel = serverBootstrap.bind(new InetSocketAddress(host, port));
    }

    super.start();
  }
View Full Code Here

    bossPool = ThreadPoolFactory.newCachedThreadPool(getClass().getPackage().getName(), "boss");
    workerPool =  ThreadPoolFactory.newCachedThreadPool(getClass().getPackage().getName(), "worker");
    pipelineFactory = new ServerPipelineFactory(getPipelineModifiers());
    ((ServerPipelineFactory)pipelineFactory).addModifier(collector.getName(), collector);
    channelFactory = new NioServerSocketChannelFactory(bossPool, workerPool);
    bstrap = new ServerBootstrap(channelFactory);
    bstrap.setPipelineFactory(pipelineFactory);
    bstrap.setOption("child.keepAlive", true);
    bstrap.bind(isock);
    LOG.info("Netty-Ajax Server Started with Root [" + contentRoot + "]");   
    try { Thread.currentThread().join(); } catch (Exception e) {
View Full Code Here

        this.localRegistry.register("total_connections", connectionCounter.gaugeTotal());
    }

    @Override
    protected Bootstrap getBootstrap() {
        final ServerBootstrap bootstrap =
                new ServerBootstrap(new NioServerSocketChannelFactory(bossExecutor, workerExecutor));

        bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(8192));
        bootstrap.setOption("child.receiveBufferSize", getRecvBufferSize());

        return bootstrap;
    }
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.