public void addSocketConfiguration(ServerBootstrapConfiguration serverBootstrapConfiguration) { // Set other serverBootstrap parameters serverBootstrap.option(ChannelOption.SO_BACKLOG, serverBootstrapConfiguration.getSoBackLog()); serverBootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, serverBootstrapConfiguration.getConnectTimeOut()); serverBootstrap.option(ChannelOption.SO_RCVBUF, serverBootstrapConfiguration.getReceiveBufferSize()); serverBootstrap.childOption(ChannelOption.TCP_NODELAY, serverBootstrapConfiguration.isTcpNoDelay()); serverBootstrap.childOption(ChannelOption.SO_RCVBUF, serverBootstrapConfiguration.getReceiveBufferSize()); serverBootstrap.childOption(ChannelOption.SO_SNDBUF, serverBootstrapConfiguration.getSendBufferSize()); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Netty Server Socket BACKLOG %d", serverBootstrapConfiguration.getSoBackLog())); LOG.debug(String.format("Netty Server Socket TCP_NODELAY %s", serverBootstrapConfiguration.isTcpNoDelay())); LOG.debug(String.format("Netty Server Socket CONNECT_TIMEOUT_MILLIS %d", serverBootstrapConfiguration.getConnectTimeOut())); LOG.debug(String.format("Netty Server Socket SO_RCVBUF %d", serverBootstrapConfiguration.getReceiveBufferSize())); LOG.debug(String.format("Netty Server Socket SO_SNDBUF %d", serverBootstrapConfiguration.getSendBufferSize())); } }
/** * Create server bootstrap configuration from given transport property set. * * @param transportPropertiesSet Set of transport properties which should be converted * to {@link ServerBootstrapConfiguration}. * @return ServerBootstrapConfiguration which is created from given Set of transport properties. */ public static ServerBootstrapConfiguration getServerBootstrapConfiguration(Set<TransportProperty> transportPropertiesSet) { Map<String, Object> transportProperties = new HashMap<>(); if (transportPropertiesSet != null && !transportPropertiesSet.isEmpty()) { transportProperties = transportPropertiesSet.stream().collect( Collectors.toMap(TransportProperty::getName, TransportProperty::getValue)); } // Create Bootstrap Configuration from listener parameters return new ServerBootstrapConfiguration(transportProperties); }