diff --git a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java index aaf422b..46f1437 100644 --- a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java +++ b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java @@ -71,13 +71,18 @@ public class GrpcServer extends Server { this.grpc = new GrpcServerImpl(this.getClient()); EventLoopGroup elg; Class channelType; - try { - elg = new EpollEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2); - channelType = EpollServerDomainSocketChannel.class; - } catch (Throwable ex) { - LOG.warn("Can't load Epoll event loop group, the server will be slower", ex); + if (http2Port != 0) { elg = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2); channelType = NioServerSocketChannel.class; + } else { + try { + elg = new EpollEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2); + channelType = EpollServerDomainSocketChannel.class; + } catch (Throwable ex) { + LOG.warn("Can't load Epoll event loop group, the server will be slower", ex); + elg = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2); + channelType = NioServerSocketChannel.class; + } } this.elg = elg; this.executor = Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors() * 2);