Search in sources :

Example 1 with NioEventLoopGroup

use of io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup in project sofa-rpc by sofastack.

the class TripleServer method constructWorkerEventLoopGroup.

private EventLoopGroup constructWorkerEventLoopGroup() {
    int workerThreads = serverConfig.getIoThreads();
    workerThreads = workerThreads <= 0 ? Runtime.getRuntime().availableProcessors() * 2 : workerThreads;
    NamedThreadFactory threadName = new NamedThreadFactory("SEV-WORKER-" + serverConfig.getPort(), serverConfig.isDaemon());
    EventLoopGroup workerGroup = serverConfig.isEpoll() ? new EpollEventLoopGroup(workerThreads, threadName) : new NioEventLoopGroup(workerThreads, threadName);
    return workerGroup;
}
Also used : EventLoopGroup(io.grpc.netty.shaded.io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup) EpollEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup) NamedThreadFactory(com.alipay.sofa.rpc.common.struct.NamedThreadFactory) EpollEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup) NioEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup)

Example 2 with NioEventLoopGroup

use of io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup in project sofa-rpc by sofastack.

the class TripleServer method constructBossEventLoopGroup.

/**
 * default as bolt
 *
 * @return
 */
private EventLoopGroup constructBossEventLoopGroup() {
    NamedThreadFactory threadName = new NamedThreadFactory("SEV-BOSS-" + serverConfig.getPort(), serverConfig.isDaemon());
    EventLoopGroup bossGroup = serverConfig.isEpoll() ? new EpollEventLoopGroup(1, threadName) : new NioEventLoopGroup(1, threadName);
    return bossGroup;
}
Also used : EventLoopGroup(io.grpc.netty.shaded.io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup) EpollEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup) NamedThreadFactory(com.alipay.sofa.rpc.common.struct.NamedThreadFactory) EpollEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup) NioEventLoopGroup(io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup)

Aggregations

NamedThreadFactory (com.alipay.sofa.rpc.common.struct.NamedThreadFactory)2 EventLoopGroup (io.grpc.netty.shaded.io.netty.channel.EventLoopGroup)2 EpollEventLoopGroup (io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup)2 NioEventLoopGroup (io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoopGroup)2