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

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


  public ProxyServer(SimpleSocketAddress listenAddress,
          final ProxyServerType type)
  {
    String host = listenAddress.host;
    int port = listenAddress.port;
    bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool()));
    bootstrap.setPipelineFactory(new ChannelPipelineFactory()
    {
      @Override
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);
        serverBootstrap.setPipelineFactory(new ServerPipelineFactory(this));
        serverBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
        serverBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
        serverBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
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

  public void startEngine() throws WebSocketException {
    if (log.isDebugEnabled()) {
      log.debug("Starting Netty engine (" + getId() + ")...");
    }
    // Configure the server.
    ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
    // Set up the event pipeline factory.
    bootstrap.setPipelineFactory(new NettyEnginePipeLineFactory(this));
    // Bind and start to accept incoming connections.
    channel = bootstrap.bind(new InetSocketAddress(getConfiguration().getPort()));
View Full Code Here

    private void run()
    {
        // Configure the server.
        executionHandler = new ExecutionHandler(new RequestThreadPoolExecutor());
        factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
        ServerBootstrap bootstrap = new ServerBootstrap(factory);

        bootstrap.setOption("child.tcpNoDelay", true);

        // Set up the event pipeline factory.
View Full Code Here

            return;
        }

        // Configure the server.
        executionHandler = new ExecutionHandler(new RequestThreadPoolExecutor());
        factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
        ServerBootstrap bootstrap = new ServerBootstrap(factory);

        bootstrap.setOption("child.tcpNoDelay", true);

        // Set up the event pipeline factory.
View Full Code Here

    tcpBacklog = conf.getInt(GiraphConstants.TCP_BACKLOG.getKey(),
        conf.getInt(GiraphConstants.MAX_WORKERS,
            GiraphConstants.TCP_BACKLOG.getDefaultValue()));

    channelFactory = new NioServerSocketChannelFactory(
        bossExecutorService,
        workerExecutorService,
        maxPoolSize);

    handlerBeforeExecutionHandler =
View Full Code Here

    private void initializeTCPServerSocketCommunicationLayer() throws Exception {
        bossExecutor = context.getExecutorServiceManager().newCachedThreadPool(this, "NettyTCPBoss");
        workerExecutor = context.getExecutorServiceManager().newCachedThreadPool(this, "NettyTCPWorker");

        if (configuration.getWorkerCount() <= 0) {
            channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
        } else {
            channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor,
                                                               configuration.getWorkerCount());
        }
        serverBootstrap = new ServerBootstrap(channelFactory);
        serverBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
        serverBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
View Full Code Here

  @Override
  public void startUp() throws Exception {
    for (String inputName : spec.getInputSchemas().keySet()) {
      Map.Entry<InputStreamFormat, StreamSchema> streamInfo = spec.getInputSchemas().get(inputName);
      ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                 Executors.newCachedThreadPool());
      InputServerSocket service;
      switch(streamInfo.getKey()) {
        case GDAT:
          service = new InputServerSocket(factory, inputName, streamInfo.getValue(),
                                          portMap.get(Constants.TCP_INGESTION_PORT_PREFIX + inputName));
          break;

        case JSON:
          service = new JsonInputServerSocket(factory, inputName, streamInfo.getValue(),
                                              portMap.get(Constants.TCP_INGESTION_PORT_PREFIX + inputName));
          break;

        default:
          throw new Exception("Unknown Input Format. Only JSON and GDAT Formats are supported.");
      }

      service.startAndWait();
      portMap.put(Constants.TCP_INGESTION_PORT_PREFIX + inputName, service.getIngestionPort());
      inputServerMap.put(inputName, service.getSocketAddressMap());
      dataIngressServerMap.put(inputName, service.getSocketAddressMap().get(Constants.StreamIO.TCP_DATA_INGESTION));
      dataSourceServerMap.put(inputName, service.getSocketAddressMap().get(Constants.StreamIO.DATASOURCE));
      inputServerSocketServices.add(service);
    }

    for (Map.Entry<String, String> output : spec.getQuery().entrySet()) {
      ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                 Executors.newCachedThreadPool());
      StreamSocketServer service = new OutputServerSocket(factory, output.getKey(), output.getValue(), recordQueue);
      service.startAndWait();
      outputServerMap.put(output.getKey(), service.getSocketAddressMap());
      dataEgressServerMap.put(output.getKey(), service.getSocketAddressMap().get(Constants.StreamIO.DATASINK));
View Full Code Here

        workerExecutor = newFixedThreadPool(workerThreads, new ThreadFactoryBuilder().setNameFormat("thrift-worker-%s").build());

        acceptorExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("thrift-acceptor-%s").build());
        ioExecutor = newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("thrift-io-%s").build());

        serverChannelFactory = new NioServerSocketChannelFactory(acceptorExecutor, ioExecutor);

        ThriftServerDef thriftServerDef = ThriftServerDef.newBuilder()
                                                         .name("thrift")
                                                         .listen(port)
                                                         .limitFrameSizeTo((int) config.getMaxFrameSize().toBytes())
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.