priyeshkaratha commented on code in PR #9047:
URL: https://github.com/apache/ozone/pull/9047#discussion_r2367215311
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -387,18 +397,22 @@ private static void blockTillTaskStop(Thread
balancingThread) {
*/
public void stopBalancer()
throws IOException, IllegalContainerBalancerStateException {
- Thread balancingThread;
+ Thread balancingThread = null;
lock.lock();
try {
- validateState(true);
+ validateEligibility();
Review Comment:
can we write this logic something like below
```
public void stopBalancer()
throws IOException, IllegalContainerBalancerStateException {
Thread balancingThread = null;
lock.lock();
try {
if (!isBalancerRunning()) {
LOG.info("ContainerBalancer already stopped;");
return;
}
validateEligibility();
saveConfiguration(config, false, 0);
LOG.info("Trying to stop ContainerBalancer service.");
task.stop();
balancingThread = currentBalancingThread;
} finally {
lock.unlock();
}
if (balancingThread != null) {
blockTillTaskStop(balancingThread);
}
}
```
--
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]