/** * Initiate Nio event loop groups * @param threadConfiguration number of threads to be created, if not specified in threadConfig */ public void initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration) { socketChannelClass = NioServerSocketChannel.class; if (threadConfiguration != null) { bossGroup = new NioEventLoopGroup(threadConfiguration.getBossThreadCount()); workerGroup = new NioEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { bossGroup = new NioEventLoopGroup(); workerGroup = new NioEventLoopGroup(); } ((NioEventLoopGroup)workerGroup).setIoRatio(100); }
/** * Initiate Nio event loop groups * @param threadConfiguration number of threads to be created, if not specified in threadConfig */ public void initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration) { datagramChannelClass = NioDatagramChannel.class; if (threadConfiguration != null) { group = new NioEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { group = new NioEventLoopGroup(); } }
/** * Initiate Epoll event loop groups with Nio as fall back * @param threadConfiguration */ protected void initiateEpollEventLoopGroups(ThreadConfiguration threadConfiguration) { try { datagramChannelClass = EpollDatagramChannel.class; if (threadConfiguration != null) { group = new EpollEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { group = new EpollEventLoopGroup(); } return; } catch (Throwable ex) { LOG.debug("Epoll initiation failed"); } //Fallback mechanism initiateNioEventLoopGroups(threadConfiguration); } }
/** * Initiate Epoll event loop groups with Nio as fall back * @param threadConfiguration */ protected void initiateEpollEventLoopGroups(ThreadConfiguration threadConfiguration) { try { socketChannelClass = EpollServerSocketChannel.class; if (threadConfiguration != null) { bossGroup = new EpollEventLoopGroup(threadConfiguration.getBossThreadCount()); workerGroup = new EpollEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { bossGroup = new EpollEventLoopGroup(); workerGroup = new EpollEventLoopGroup(); } ((EpollEventLoopGroup)workerGroup).setIoRatio(100); return; } catch (Throwable ex) { LOG.debug("Epoll initiation failed"); } //Fallback mechanism initiateNioEventLoopGroups(threadConfiguration); }