Example usage for io.netty.channel DefaultSelectStrategyFactory INSTANCE

List of usage examples for io.netty.channel DefaultSelectStrategyFactory INSTANCE

Introduction

In this page you can find the example usage for io.netty.channel DefaultSelectStrategyFactory INSTANCE.

Prototype

SelectStrategyFactory INSTANCE

To view the source code for io.netty.channel DefaultSelectStrategyFactory INSTANCE.

Click 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  w ww .ja  v  a  2  s  . c om*/
 * 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;
}