sv2000 commented on a change in pull request #2907: [GOBBLIN-1068]Clean up 
cyclic logic in task cancellation
URL: https://github.com/apache/incubator-gobblin/pull/2907#discussion_r404219750
 
 

 ##########
 File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/GobblinMultiTaskAttempt.java
 ##########
 @@ -152,13 +155,15 @@ public void run()
     }
 
     CountUpAndDownLatch countDownLatch = new CountUpAndDownLatch(0);
-    this.tasks = runWorkUnits(countDownLatch);
+    Pair<List<Task>, List<Future<?>>> taskExecutionResult = 
runWorkUnits(countDownLatch);
+    this.tasks = taskExecutionResult.getLeft();
+    this.taskFutures = taskExecutionResult.getRight();
     log.info("Waiting for submitted tasks of job {} to complete in container 
{}...", jobId, containerIdOptional.or(""));
     try {
       while (countDownLatch.getCount() > 0) {
         if (this.interruptionPredicate.test(this)) {
           log.info("Interrupting task execution due to satisfied predicate.");
-          interruptTaskExecution(countDownLatch);
+          interruptTaskExecution(Optional.of(countDownLatch));
 
 Review comment:
   Optional is not intended to be used as a function parameter and should be 
used only as a return value. 
[Here](https://www.quora.com/Why-is-using-java-util-Optional-as-a-method-parameter-not-recommended)
 is one of several references describing the problems with using Optional as a 
function parameter.

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


With regards,
Apache Git Services

Reply via email to