Example usage for io.netty.channel.unix UnixChannelOption SO_REUSEPORT

List of usage examples for io.netty.channel.unix UnixChannelOption SO_REUSEPORT

Introduction

In this page you can find the example usage for io.netty.channel.unix UnixChannelOption SO_REUSEPORT.

Prototype

ChannelOption SO_REUSEPORT

To view the source code for io.netty.channel.unix UnixChannelOption SO_REUSEPORT.

Click Source Link

Usage

From source file:org.graylog2.inputs.transports.UdpTransport.java

License:Open Source License

@VisibleForTesting
Bootstrap getBootstrap(MessageInput input) {
    LOG.debug("Setting UDP receive buffer size to {} bytes", getRecvBufferSize());
    final NettyTransportType transportType = nettyTransportConfiguration.getType();

    eventLoopGroup = eventLoopGroupFactory.create(workerThreads, localRegistry, "workers");

    return new Bootstrap().group(eventLoopGroup).channelFactory(new DatagramChannelFactory(transportType))
            .option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(getRecvBufferSize()))
            .option(ChannelOption.SO_RCVBUF, getRecvBufferSize()).option(UnixChannelOption.SO_REUSEPORT, true)
            .handler(getChannelInitializer(getChannelHandlers(input))).validate();
}