Examples of ServerBootstrap


Examples of org.jboss.netty.bootstrap.ServerBootstrap

  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

Examples of org.jboss.netty.bootstrap.ServerBootstrap

  @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

Examples of org.jboss.netty.bootstrap.ServerBootstrap

    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

Examples of org.jboss.netty.bootstrap.ServerBootstrap

        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

Examples of org.jboss.netty.bootstrap.ServerBootstrap

        return new InstrumentedThreadFactory(
                new ThreadFactoryBuilder().setNameFormat(nameFormat).build(), metricRegistry);
    }

    private static ServerBootstrap buildServerBootStrap(final ExecutorService bossExecutor, final ExecutorService workerExecutor) {
        return new ServerBootstrap(new NioServerSocketChannelFactory(bossExecutor, workerExecutor));
    }
View Full Code Here

Examples of org.jboss.netty.bootstrap.ServerBootstrap

    popupMenu.add(exitMenuItem);
    trayIcon.setPopupMenu(popupMenu);
    SystemTray.getSystemTray().add(trayIcon);

        /* Create AirTunes RTSP server */
    final ServerBootstrap airTunesRtspBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(ExecutorService, ExecutorService));
    airTunesRtspBootstrap.setPipelineFactory(new RaopRtspPipelineFactory());
    airTunesRtspBootstrap.setOption("reuseAddress", true);
    airTunesRtspBootstrap.setOption("child.tcpNoDelay", true);
    airTunesRtspBootstrap.setOption("child.keepAlive", true);
    s_allChannels.add(airTunesRtspBootstrap.bind(new InetSocketAddress(Inet4Address.getByName("0.0.0.0"), AirtunesServiceRTSPPort)));
        s_logger.info("Launched RTSP service on port " + AirtunesServiceRTSPPort);

      /* Create mDNS responders. */
        synchronized(s_jmDNSInstances) {
        for(final NetworkInterface iface: Collections.list(NetworkInterface.getNetworkInterfaces())) {
View Full Code Here

Examples of org.jboss.netty.bootstrap.ServerBootstrap

    System.out.println("[Server]:" + msg);
  }
 
  public static void bootServer() {
    // More terse code to setup the server
    ServerBootstrap bootstrap = new ServerBootstrap(
        new NioServerSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool()));

    // Set up the pipeline factory.
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(
          new ObjectDecoder(ClassResolvers.cacheDisabled(getClass().getClassLoader())),
          new SimpleChannelHandler() {
            public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
              Date date = (Date)e.getMessage();
              slog("Hey Guys !  I got a date ! [" + date + "]");
              super.messageReceived(ctx, e);
            }
          }
        );
      };
    });

    // Bind and start to accept incoming connections.
    bootstrap.bind(new InetSocketAddress("0.0.0.0", 8080));
    slog("Listening on 8080");
  }
View Full Code Here

Examples of org.jboss.netty.bootstrap.ServerBootstrap

  }
 
  public static void bootServer() {
   
    // More terse code to setup the server
    ServerBootstrap bootstrap = new ServerBootstrap(
        new NioServerSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool()));

    // Set up the pipeline factory.
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(
          new ObjectDecoder(ClassResolvers.cacheDisabled(getClass().getClassLoader())),
          new ObjectEncoder(),
          new ServerDateHandler()
        );
      };
    });

    // Bind and start to accept incoming connections.
    bootstrap.bind(new InetSocketAddress("0.0.0.0", 8080));
    // Telling the default logging to pipe down
    java.util.logging.LogManager.getLogManager().getLogger(DefaultChannelPipeline.class.getName()).setLevel(Level.SEVERE);
    slog("Listening on 8080");
  }
View Full Code Here

Examples of org.jboss.netty.bootstrap.ServerBootstrap

  }

  public Bootstrap createServerBootstrap()
  {
    // TODO The thread pools should be injected from spring.
    serverBootstrap = new ServerBootstrap(
        new NioServerSocketChannelFactory(Executors
            .newCachedThreadPool(new NamedThreadFactory(
                "TCP-Server-Boss")), Executors
            .newCachedThreadPool(new NamedThreadFactory(
                "TCP-Server-Worker"))));
View Full Code Here

Examples of org.jboss.netty.bootstrap.ServerBootstrap

  }

  public Bootstrap createServerBootstrap()
  {
    // TODO The thread pools should be injected from spring.
    serverBootstrap = new ServerBootstrap(
       
        new NioServerSocketChannelFactory(Executors
            .newFixedThreadPool(1,new NamedThreadFactory(
                "Flash-Server-Boss")), Executors
            .newFixedThreadPool(1,new NamedThreadFactory(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.