- serverBootstrap.childHandler(BGPChannel.createChannelInitializer(initializer, new DefaultPromise(BGPDispatcherImpl.this.executor)));
- serverBootstrap.option(ChannelOption.SO_BACKLOG, Integer.valueOf(SOCKET_BACKLOG_SIZE));
- serverBootstrap.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
- serverBootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
- serverBootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
- if (this.keys.isPresent()) {
- if (this.serverChannelFactory == null) {
- throw new UnsupportedOperationException("No key access instance available, cannot use key mapping");
- }
- serverBootstrap.channelFactory(this.serverChannelFactory);
- serverBootstrap.option(MD5ChannelOption.TCP_MD5SIG, this.keys.get());
+ if (Epoll.isAvailable()) {
+ serverBootstrap.channel(EpollServerSocketChannel.class);
+ serverBootstrap.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);