reele commented on a change in pull request #6063:
URL: https://github.com/apache/dolphinscheduler/pull/6063#discussion_r701055170



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/SubProcessTaskExecThread.java
##########
@@ -112,6 +112,31 @@ private void updateParentProcessState(){
         this.processInstance.setState(parentProcessInstance.getState());
     }
 
+    /**
+     * wait for the establishment of sub-process-instance
+     * @throws InterruptedException
+     */
+    private void waitSubProcessEstablishment() throws InterruptedException {
+        if (subProcessInstance == null) {
+            while (Stopper.isRunning()) {
+                Thread.sleep(Constants.SLEEP_TIME_MILLIS);
+                if (setTaskInstanceState()) {
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * check if both task and sub-process are both finished
+     * (when recover a stopping instance, subProcessInstance may still in 
running by fault-tolerant)
+     */
+    private boolean isTaskInstanceFinished() {
+        boolean isSubProcessFinished = (subProcessInstance == null || 
subProcessInstance.getState().typeIsFinished());

Review comment:
       It is used to ensure that `subProcessInstance.getState()` is valid, it 
may still be null at this position.




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


Reply via email to