CRZbulabula commented on code in PR #1466:
URL: https://github.com/apache/ratis/pull/1466#discussion_r3315322726


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java:
##########
@@ -60,15 +62,36 @@ public class GrpcClientRpc extends 
RaftClientRpcWithProxy<GrpcClientProtocolClie
   private final int maxMessageSize;
   private final TimeDuration requestTimeoutDuration;
   private final TimeDuration watchRequestTimeoutDuration;
+  private final EventLoopGroup clientWorkers;

Review Comment:
   Done in 00bd24ef. `GrpcClientRpc` now stores the client workers as a 
`MemoizedSupplier<EventLoopGroup>`, and `GrpcClientProtocolClient` obtains the 
group lazily when building a channel.



##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java:
##########
@@ -213,6 +236,15 @@ private RaftClientRequestProto 
toRaftClientRequestProto(RaftClientRequest reques
     return proto;
   }
 
+  @Override
+  public void close() {
+    try {
+      super.close();
+    } finally {
+      NettyUtils.shutdownGracefully(clientWorkers);

Review Comment:
   Done in 00bd24ef. `close()` now checks `clientWorkers.isInitialized()` 
before shutting down the shared client worker group.



##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java:
##########
@@ -60,15 +62,36 @@ public class GrpcClientRpc extends 
RaftClientRpcWithProxy<GrpcClientProtocolClie
   private final int maxMessageSize;
   private final TimeDuration requestTimeoutDuration;
   private final TimeDuration watchRequestTimeoutDuration;
+  private final EventLoopGroup clientWorkers;
 
   public GrpcClientRpc(ClientId clientId, RaftProperties properties,
       SslContext adminSslContext, SslContext clientSslContext) {
+    this(clientId, properties, adminSslContext, clientSslContext, 
newClientWorkers(clientId, properties));
+  }

Review Comment:
   Done in 00bd24ef. I added `GrpcClientRpc.create(...)`, made the constructor 
private, and updated `GrpcFactory` to use the factory method.



-- 
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]

Reply via email to