yandrey321 commented on code in PR #9648:
URL: https://github.com/apache/ozone/pull/9648#discussion_r2708771374


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java:
##########
@@ -299,13 +299,42 @@ public void shutdown() {
     for (Map.Entry<String, ManagedChannel> entry : channels.entrySet()) {
       ManagedChannel channel = entry.getValue();
       channel.shutdown();
+    }
+
+    final long maxWaitMillis = TimeUnit.SECONDS.toMillis(5);
+    long startDeadline = System.currentTimeMillis();
+    long elapsed = 0;
+    boolean allTerminated = false;
+
+    while (elapsed < maxWaitMillis) {
+      allTerminated = true;
+      for (Map.Entry<String, ManagedChannel> entry : channels.entrySet()) {

Review Comment:
   1. collect all channels into the list before the while loop 
   2. when channel is terminated remove it from the list (inside while loop)
   3. the last 'for' loop for warning messages can be replaced with a single 
log with a list of remaining non-closed channels.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to