Search in sources :

Example 1 with NettyExecutor

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();
}
Also used : WebServerConnectorFactory(com.hotels.styx.server.netty.WebServerConnectorFactory) StyxConfig(com.hotels.styx.StyxConfig) NettyServerBuilder(com.hotels.styx.server.netty.NettyServerBuilder) NettyExecutor(com.hotels.styx.NettyExecutor)

Aggregations

NettyExecutor (com.hotels.styx.NettyExecutor)1 StyxConfig (com.hotels.styx.StyxConfig)1 NettyServerBuilder (com.hotels.styx.server.netty.NettyServerBuilder)1 WebServerConnectorFactory (com.hotels.styx.server.netty.WebServerConnectorFactory)1