siddhantsangwan commented on a change in pull request #2578:
URL: https://github.com/apache/ozone/pull/2578#discussion_r704308026



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -722,8 +722,10 @@ public void stop() {
         return;
       }
       balancerRunning = false;
-      currentBalancingThread.interrupt();
-      currentBalancingThread.join(1000);
+      if (Thread.currentThread().getId() != currentBalancingThread.getId()) {
+        currentBalancingThread.interrupt();
+        currentBalancingThread.join(100);

Review comment:
       Good point, I agree. We probably don't want to use `thread.stop()`. We 
can check the `balancerRunning` flag and interrupted status regularly while 
performing long operations in `doIteration` and `initializeIteration`. This 
will allow the `currentBalancingThread` to stop gracefully.




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