Example usage for io.netty.channel.nio NioEventLoopGroup NioEventLoopGroup

List of usage examples for io.netty.channel.nio NioEventLoopGroup NioEventLoopGroup

Introduction

In this page you can find the example usage for io.netty.channel.nio NioEventLoopGroup NioEventLoopGroup.

Prototype

public NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider,
            final SelectStrategyFactory selectStrategyFactory) 

Source Link

Usage

From source file:com.ibasco.agql.core.transport.NettyTransport.java

License:Open Source License

/**
 * <p>A factory method that manufactures {@link EventLoopGroup} based on {@link ChannelType}. If the platform
 * supports/*from www . j a v a2s .c  o  m*/
 * Epoll and the channel type is NIO, it will return {@link EpollEventLoopGroup} instead.</p>
 *
 * @param type
 *         The {@link ChannelType} that will determine which {@link EventLoopGroup} will be returned.
 *
 * @return The concrete {@link EventLoopGroup} instance that will be used by the transport.
 */
private EventLoopGroup createEventLoopGroup(ChannelType type) {
    switch (type) {
    case NIO_TCP:
    case NIO_UDP:
        if (Epoll.isAvailable()) {
            log.debug("Using EpollEventLoopGroup");
            return new EpollEventLoopGroup(8, executorService, DefaultSelectStrategyFactory.INSTANCE);
        }
        return new NioEventLoopGroup(8, executorService, SelectorProvider.provider(),
                DefaultSelectStrategyFactory.INSTANCE);
    }
    return null;
}