1u0 commented on a change in pull request #8409: [FLINK-12478] Decompose 
monolithic run-loops in StreamTask implementa…
URL: https://github.com/apache/flink/pull/8409#discussion_r284571911
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
 ##########
 @@ -41,88 +42,73 @@
 
        private static final Logger LOG = 
LoggerFactory.getLogger(StreamIterationHead.class);
 
-       private volatile boolean running = true;
+       private RecordWriterOutput<OUT>[] streamOutputs;
+
+       private final BlockingQueue<StreamRecord<OUT>> dataChannel;
+       private final String brokerID;
+       private final long iterationWaitTime;
+       private final boolean shouldWait;
 
        public StreamIterationHead(Environment env) {
                super(env);
+               final String iterationId = getConfiguration().getIterationId();
+               if (iterationId == null || iterationId.length() == 0) {
+                       throw new FlinkRuntimeException("Missing iteration ID 
in the task configuration");
+               }
+
+               this.dataChannel = new ArrayBlockingQueue<>(1);
+               this.brokerID = 
createBrokerIdString(getEnvironment().getJobID(), iterationId,
+                       getEnvironment().getTaskInfo().getIndexOfThisSubtask());
+               this.iterationWaitTime = 
getConfiguration().getIterationWaitTime();
+               this.shouldWait = iterationWaitTime > 0;
 
 Review comment:
   I'd move this whole new code block into `init` method. This way it would be 
similar to `StreamIterationTail` and also avoid unneeded initialization in not 
task-execution contexts.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to