Example usage for io.netty.channel.epoll EpollEventLoopGroup EpollEventLoopGroup

List of usage examples for io.netty.channel.epoll EpollEventLoopGroup EpollEventLoopGroup

Introduction

In this page you can find the example usage for io.netty.channel.epoll EpollEventLoopGroup EpollEventLoopGroup.

Prototype

public EpollEventLoopGroup(int nThreads, Executor executor, 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  ww  w.j  av  a 2s  .  co 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;
}