ChenSammi commented on a change in pull request #2278:
URL: https://github.com/apache/ozone/pull/2278#discussion_r656710599



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -96,42 +101,63 @@ public ContainerBalancer(
     this.underUtilizedNodes = new ArrayList<>();
     this.unBalancedNodes = new ArrayList<>();
     this.withinThresholdUtilizedNodes = new ArrayList<>();
+    this.lock = new ReentrantLock();
   }
-
   /**
    * Starts ContainerBalancer. Current implementation is incomplete.
    *
    * @param balancerConfiguration Configuration values.
    */
-  public boolean start(ContainerBalancerConfiguration balancerConfiguration) {
-    if (!balancerRunning.compareAndSet(false, true)) {
-      LOG.error("Container Balancer is already running.");
-      return false;
+  public boolean start(
+      ContainerBalancerConfiguration balancerConfiguration) {
+    lock.lock();
+    try {
+      if (!balancerRunning.compareAndSet(false, true)) {
+        LOG.error("Container Balancer is already running.");

Review comment:
       error -> info




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

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