Skip to content

Commit 047444b

Browse files
authored
RATIS-2342. Remove NIO specification from GrpcStubPool. (#1297)
1 parent ce4177e commit 047444b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcStubPool.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import org.apache.ratis.thirdparty.io.grpc.stub.AbstractStub;
2525
import org.apache.ratis.thirdparty.io.netty.channel.ChannelOption;
2626
import org.apache.ratis.thirdparty.io.netty.channel.WriteBufferWaterMark;
27-
import org.apache.ratis.thirdparty.io.netty.channel.nio.NioEventLoopGroup;
28-
import org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioSocketChannel;
2927
import org.apache.ratis.thirdparty.io.netty.handler.ssl.SslContext;
3028
import org.slf4j.Logger;
3129
import org.slf4j.LoggerFactory;
@@ -62,21 +60,17 @@ void release() {
6260
}
6361

6462
private final List<PooledStub<S>> pool;
65-
private final NioEventLoopGroup elg;
6663
private final int size;
6764

6865
GrpcStubPool(RaftPeer target, int n, Function<ManagedChannel, S> stubFactory, SslContext sslContext) {
69-
this(target, n, stubFactory, sslContext, Math.max(2, Runtime.getRuntime().availableProcessors() / 2), 16);
66+
this(target, n, stubFactory, sslContext, 16);
7067
}
7168

7269
GrpcStubPool(RaftPeer target, int n, Function<ManagedChannel, S> stubFactory, SslContext sslContext,
73-
int elgThreads, int maxInflightPerConn) {
74-
this.elg = new NioEventLoopGroup(elgThreads);
70+
int maxInflightPerConn) {
7571
ArrayList<PooledStub<S>> tmp = new ArrayList<>(n);
7672
for (int i = 0; i < n; i++) {
7773
NettyChannelBuilder channelBuilder = NettyChannelBuilder.forTarget(target.getAddress())
78-
.eventLoopGroup(elg)
79-
.channelType(NioSocketChannel.class)
8074
.keepAliveTime(30, TimeUnit.SECONDS)
8175
.keepAliveWithoutCalls(true)
8276
.idleTimeout(24, TimeUnit.HOURS)
@@ -112,6 +106,5 @@ public void close() {
112106
for (PooledStub<S> p : pool) {
113107
p.ch.shutdown();
114108
}
115-
elg.shutdownGracefully();
116109
}
117110
}

0 commit comments

Comments
 (0)