himanshukandwal commented on code in PR #2600:
URL: https://github.com/apache/helix/pull/2600#discussion_r1296402820


##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java:
##########
@@ -450,22 +452,17 @@ protected Map<String, ResourceAssignment> 
emergencyRebalance(
             resourceMap.keySet());
 
     // Step 1: Check for permanent node down
-    AtomicBoolean allNodesActive = new AtomicBoolean(true);
-    
currentBestPossibleAssignment.values().parallelStream().forEach((resourceAssignment
 -> {
-      
resourceAssignment.getMappedPartitions().parallelStream().forEach(partition -> {
-        for (String instance : 
resourceAssignment.getReplicaMap(partition).keySet()) {
-          if (!activeNodes.contains(instance)) {
-            allNodesActive.set(false);
-            break;
-          }
-        }
-      });
-    }));
-
+    boolean allNodesActive = currentBestPossibleAssignment.values().stream()

Review Comment:
   Thanks Komal for the review. 
   Atomic<> was required for 2 reasons as it was getting used in a parallel 
(async) mode and secondly, becuase in stream() we cannot update a variable 
directly using value assignment, as it should be implicit final (so native 
`boolean` wouldnt have worked).. so with AtomicBoolean we can update the 
property of a variable, rather than the value itself. 
   
   Other than that there is not much difference from earlier code.



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