use of io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup 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;
}
use of io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup in project grpc-spring-boot-starter by yidongnan.
the class ShadedNettyGrpcServerFactory method newServerBuilder.
@Override
protected NettyServerBuilder newServerBuilder() {
final String address = getAddress();
final int port = getPort();
if (address.startsWith(DOMAIN_SOCKET_ADDRESS_PREFIX)) {
final String path = GrpcUtils.extractDomainSocketAddressPath(address);
return NettyServerBuilder.forAddress(new DomainSocketAddress(path)).channelType(EpollServerDomainSocketChannel.class).bossEventLoopGroup(new EpollEventLoopGroup(1)).workerEventLoopGroup(new EpollEventLoopGroup());
} else if (ANY_IP_ADDRESS.equals(address)) {
return NettyServerBuilder.forPort(port);
} else {
return NettyServerBuilder.forAddress(new InetSocketAddress(InetAddresses.forString(address), port));
}
}
use of io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup in project grpc-spring-boot-starter by yidongnan.
the class ShadedNettyChannelFactory method newChannelBuilder.
@Override
protected NettyChannelBuilder newChannelBuilder(final String name) {
final GrpcChannelProperties properties = getPropertiesFor(name);
URI address = properties.getAddress();
if (address == null) {
address = URI.create(name);
}
if (DOMAIN_SOCKET_ADDRESS_SCHEME.equals(address.getScheme())) {
final String path = GrpcUtils.extractDomainSocketAddressPath(address.toString());
return NettyChannelBuilder.forAddress(new DomainSocketAddress(path)).channelType(EpollDomainSocketChannel.class).eventLoopGroup(new EpollEventLoopGroup());
} else {
return NettyChannelBuilder.forTarget(address.toString()).defaultLoadBalancingPolicy(properties.getDefaultLoadBalancingPolicy());
}
}
use of io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup 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;
}
Aggregations