CRZbulabula commented on code in PR #1466:
URL: https://github.com/apache/ratis/pull/1466#discussion_r3315324316
##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolClient.java:
##########
@@ -90,6 +96,10 @@ private ManagedChannel buildChannel(RaftPeer target, int
flowControlWindow, SslC
channelBuilder.negotiationType(NegotiationType.PLAINTEXT);
}
channelBuilder.disableRetry();
+ if (eventLoopGroup != null) {
Review Comment:
Done in 00bd24ef. The constructor now uses
`Objects.requireNonNull(eventLoopGroup, "eventLoopGroup == null")`, and
`buildChannel(...)` always sets the channel type and event-loop group.
##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServicesImpl.java:
##########
@@ -235,7 +243,21 @@ Server newServer(GrpcClientProtocolService client,
ServerInterceptor interceptor
}
public GrpcServicesImpl build() {
- return new GrpcServicesImpl(this);
+ final RaftProperties props = server.getProperties();
+ final String id = server.getId() + "";
+ final boolean useEpoll = GrpcConfigKeys.useEpoll(props);
+ try {
+ serverBosses = NettyUtils.newEventLoopGroup(id + "-boss",
+ GrpcConfigKeys.Server.bossGroupSize(props), useEpoll);
+ serverWorkers = NettyUtils.newEventLoopGroup(id + "-server-workers",
+ GrpcConfigKeys.Server.workerGroupSize(props), useEpoll);
+ clientWorkers = NettyUtils.newEventLoopGroup(id + "-client-workers",
+ GrpcConfigKeys.Client.workerGroupSize(props), useEpoll);
+ return new GrpcServicesImpl(this);
+ } catch (RuntimeException | Error e) {
Review Comment:
Done in 00bd24ef. `Builder#build()` now catches `Throwable`, shuts down
`clientWorkers`, `serverWorkers`, and `serverBosses`, then rethrows
`RuntimeException` and `Error` directly.
##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcStubPool.java:
##########
@@ -53,6 +55,10 @@ static ManagedChannel buildManagedChannel(String address,
SslContext sslContext)
} else {
channelBuilder.negotiationType(NegotiationType.PLAINTEXT);
}
+ if (eventLoopGroup != null) {
Review Comment:
Done in 00bd24ef. `GrpcStubPool.buildManagedChannel(...)` now requires a
non-null event-loop group and always wires it into the Netty channel builder.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]