mynameborat commented on a change in pull request #1448:
URL: https://github.com/apache/samza/pull/1448#discussion_r536481015



##########
File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerProcessManager.java
##########
@@ -653,6 +656,20 @@ private String getPendingProcessorId(String containerId) {
     return null;
   }
 
+  /**
+   * Obtains the ID of the processor which is already running at a resource.
+   * @param resource where the processor is running
+   * @return the logical processorId of the processor (e.g., 0, 1, 2 ..)
+   */
+  private String getRunningProcessorId(SamzaResource resource) {
+    return state.runningProcessors.entrySet()
+        .stream()
+        .filter(e -> e.getValue().equals(resource))
+        .map(Map.Entry::getKey)
+        .findFirst()
+        .orElse(null);
+  }
+

Review comment:
       Why not use `getRunningProcessor` below by just using 
`getRunningProcessorId(resource.getContainerId()` instead?




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