hailin0 commented on code in PR #4048:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4048#discussion_r1098216000


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java:
##########
@@ -207,6 +213,16 @@ public TaskLocation getTaskMemberLocationByIndex(int 
taskIndex) {
         return taskIndexToTaskLocationMapping.get(taskIndex);
     }
 
+    @SuppressWarnings("checkstyle:MagicNumber")
+    private SourceSplitEnumerator<SplitT, Serializable> getEnumerator() throws 
InterruptedException, ExecutionException {
+        //(restoreComplete == null) means that the Task has not yet executed 
Init, so we need to wait.
+        while (null == restoreComplete){
+            Thread.sleep(200);

Review Comment:
   add log



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java:
##########
@@ -160,28 +161,33 @@ public void restoreState(List<ActionSubtaskState> 
actionStateList) throws Except
             this.enumerator = this.source.getSource()
                 .createEnumerator(enumeratorContext);
         }
-        restoreComplete = true;
+        restoreComplete.complete(null);
     }
 
-    public void addSplitsBack(List<SplitT> splits, int subtaskId) {
-        enumerator.addSplitsBack(splits, subtaskId);
+    public void addSplitsBack(List<SplitT> splits, int subtaskId) throws 
ExecutionException, InterruptedException {
+        getEnumerator().addSplitsBack(splits, subtaskId);
     }
 
-    public void receivedReader(TaskLocation readerId, Address memberAddr) {
+    @SuppressWarnings("checkstyle:MagicNumber")
+    public void receivedReader(TaskLocation readerId, Address memberAddr)
+        throws InterruptedException, ExecutionException {
         LOGGER.info("received reader register, readerID: " + readerId);
+
+        SourceSplitEnumerator<SplitT, Serializable> en = getEnumerator();

Review Comment:
   ```suggestion
           SourceSplitEnumerator<SplitT, Serializable> enumerator = 
getEnumerator();
   ```



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