use of com.hotels.styx.NettyExecutor in project styx by ExpediaGroup.
the class AdminServerBuilder method build.
public InetServer build() {
LOG.debug("event bus that will be used is {}", environment.eventBus());
StyxConfig styxConfig = environment.configuration();
AdminServerConfig adminServerConfig = styxConfig.adminServerConfig();
NettyExecutor bossExecutor = NettyExecutor.create("Admin-Boss", adminServerConfig.bossThreadsCount());
NettyExecutor workerExecutor = NettyExecutor.create("Admin-Worker", adminServerConfig.workerThreadsCount());
NettyServerBuilder builder = NettyServerBuilder.newBuilder().setMetricsRegistry(environment.metricRegistry()).bossExecutor(bossExecutor).workerExecutor(workerExecutor).handler(adminEndpoints(styxConfig, startupConfig)).shutdownAction(() -> {
bossExecutor.shut();
workerExecutor.shut();
});
// Currently admin server cannot be started over TLS protocol.
// This appears to be an existing issue that needs rectifying.
adminServerConfig.httpConnectorConfig().ifPresent(it -> builder.setProtocolConnector(new WebServerConnectorFactory().create(it)));
return builder.build();
}
Aggregations