autumnust commented on a change in pull request #3039:
URL: https://github.com/apache/incubator-gobblin/pull/3039#discussion_r439142383



##########
File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnService.java
##########
@@ -192,7 +190,7 @@
   // A queue of unused Helix instance names. An unused Helix instance name 
gets put

Review comment:
       Can you fix the comment here? 

##########
File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnService.java
##########
@@ -699,7 +700,8 @@ protected void handleContainerCompletion(ContainerStatus 
containerStatus) {
 
       // Add the Helix instance name of the completed container to the queue 
of unused

Review comment:
       Same for the comment here

##########
File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnService.java
##########
@@ -753,8 +755,19 @@ public void onContainersAllocated(List<Container> 
containers) {
 
         LOGGER.info(String.format("Container %s has been allocated", 
container.getId()));
 
-        String instanceName = unusedHelixInstanceNames.poll();
-        while (Strings.isNullOrEmpty(instanceName) || 
HelixUtils.isInstanceLive(helixManager, instanceName)) {
+        //Iterate over the (thread-safe) set of unused instances to find the 
first instance that is not currently live.
+        //Once we find a candidate instance, it is removed from the set.
+        String instanceName = null;
+        for (Iterator<String> iterator = unusedHelixInstanceNames.iterator(); 
iterator.hasNext(); ) {

Review comment:
       for loop doesn't seem to fit here but it seems more intuitive to use 
while ? 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to