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

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


    }

    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());
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
View Full Code Here

  private Server createSslServer(AvroSourceProtocol protocol)
      throws IllegalAccessException, InstantiationException {
    Server server = new NettyServer(new SpecificResponder(
        AvroSourceProtocol.class, protocol), new InetSocketAddress(hostname, port),
            new NioServerSocketChannelFactory(
                    Executors.newCachedThreadPool(),
                    Executors.newCachedThreadPool()),
            new SSLChannelPipelineFactory(),
            null);
View Full Code Here

  public void start() {
    logger.info("Starting {}...", this);

    Responder responder = new SpecificResponder(AvroSourceProtocol.class, this);

    NioServerSocketChannelFactory socketChannelFactory = initSocketChannelFactory();

    ChannelPipelineFactory pipelineFactory = initChannelPipelineFactory();

    server = new NettyServer(responder, new InetSocketAddress(bindAddress, port),
          socketChannelFactory, pipelineFactory, null);
View Full Code Here

    logger.info("Avro source {} started.", getName());
  }

  private NioServerSocketChannelFactory initSocketChannelFactory() {
    NioServerSocketChannelFactory socketChannelFactory;
    if (maxThreads <= 0) {
      socketChannelFactory = new NioServerSocketChannelFactory
        (Executors.newCachedThreadPool(new ThreadFactoryBuilder().
          setNameFormat("Avro " + NettyTransceiver.class.getSimpleName()
            + " Boss-%d").build()),
          Executors.newCachedThreadPool(new ThreadFactoryBuilder().
            setNameFormat("Avro " + NettyTransceiver.class.getSimpleName()
              + "  I/O Worker-%d").build()));
    } else {
      socketChannelFactory = new NioServerSocketChannelFactory(
        Executors.newCachedThreadPool(new ThreadFactoryBuilder().
          setNameFormat(
            "Avro " + NettyTransceiver.class.getSimpleName()
              + " Boss-%d").build()),
        Executors.newFixedThreadPool(maxThreads, new ThreadFactoryBuilder().
View Full Code Here

    listenerSocket = new InetSocketAddress("0.0.0.0", port);
    bossThreadFactory = new ExecutorThreadFactory("BossPool-[" + port + "]", true);
    workerThreadFactory = new ExecutorThreadFactory("WorkerPool-[" + port + "]", true);
    bossPool = Executors.newCachedThreadPool(bossThreadFactory);
    workerPool = Executors.newCachedThreadPool(workerThreadFactory);
    channelFactory = new NioServerSocketChannelFactory(bossPool, workerPool);
    pipelineFactory = new ChannelPipelineFactoryImpl(providers);
    bootstrap = new CustomServerBootstrap(channelFactory);
    bootstrap.setOptions(channelOptions);
    bootstrap.setPipelineFactory(pipelineFactory);
    new BootstrapJMXManager(bootstrap, "org.helios.netty:service=ServerBootstrap,name=SimpleNIOServer");
View Full Code Here

    MetricCollector collector = MetricCollector.getInstance(5000);
    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 + "]");   
View Full Code Here

        //You need then to create a DuplexTcpServerBootstrap and provide it an RpcCallExecutor.


        DuplexTcpServerBootstrap bootstrap = new DuplexTcpServerBootstrap(
                serverInfo,
                new NioServerSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool())
        );

        bootstrap.setRpcServerCallExecutor(new ThreadPoolCallExecutor(10, 10));
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.