Exemplo n.º 1
0
  public void start() {
    this.host =
        ConfigurationManager.getConfigInstance()
            .getString("netty.http.host", "not-found-in-configuration");
    this.port =
        ConfigurationManager.getConfigInstance().getInt("netty.http.port", Integer.MIN_VALUE);

    final PackagesResourceConfig rcf =
        new PackagesResourceConfig(
            ConfigurationManager.getConfigInstance()
                .getString("jersey.resources.package", "not-found-in-configuration"));

    nettyServer =
        NettyServer.builder()
            .host(host)
            .port(port)
            .addHandler(
                "jerseyHandler", ContainerFactory.createContainer(NettyHandlerContainer.class, rcf))
            .numBossThreads(NettyServer.cpus)
            .numWorkerThreads(NettyServer.cpus * 4)
            .build();
    try {
      karyonServer.start();
    } catch (Exception exc) {
      throw new RuntimeException("Cannot start karyon server.", exc);
    }
  }
Exemplo n.º 2
0
  public BaseNettyServer() {

    // This must be set before karyonServer.initialize() otherwise the
    // archaius properties will not be available in JMX/jconsole
    System.setProperty(DynamicPropertyFactory.ENABLE_JMX, "true");

    this.karyonServer = new KaryonServer();
    this.injector = karyonServer.initialize();
  }