pnowojski commented on a change in pull request #9564: 
[FLINK-12481][FLINK-12482][FLINK-12958] Streaming runtime: integrate mailbox 
for timer triggers, checkpoints and AsyncWaitOperator
URL: https://github.com/apache/flink/pull/9564#discussion_r319463940
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorFactory.java
 ##########
 @@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.api.operators.async;
+
+import org.apache.flink.streaming.api.datastream.AsyncDataStream;
+import org.apache.flink.streaming.api.functions.async.AsyncFunction;
+import org.apache.flink.streaming.api.graph.StreamConfig;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.Output;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+import org.apache.flink.streaming.api.operators.YieldingOperatorFactory;
+import org.apache.flink.streaming.runtime.tasks.StreamTask;
+import 
org.apache.flink.streaming.runtime.tasks.mailbox.execution.MailboxExecutor;
+
+/**
+ * The factory of {@link AsyncWaitOperator}.
+ *
+ * @param <OUT> The output type of the operator
+ */
+public class AsyncWaitOperatorFactory<IN, OUT> implements 
OneInputStreamOperatorFactory<IN, OUT>, YieldingOperatorFactory<OUT> {
+       private final AsyncFunction<IN, OUT> asyncFunction;
+       private final long timeout;
+       private final int capacity;
+       private final AsyncDataStream.OutputMode outputMode;
+       private MailboxExecutor mailboxExecutor;
+       private ChainingStrategy strategy = ChainingStrategy.HEAD;
+
+       public AsyncWaitOperatorFactory(
+                       AsyncFunction<IN, OUT> asyncFunction,
+                       long timeout,
+                       int capacity,
+                       AsyncDataStream.OutputMode outputMode) {
+               this.asyncFunction = asyncFunction;
+               this.timeout = timeout;
+               this.capacity = capacity;
+               this.outputMode = outputMode;
+       }
+
+       @Override public void setMailboxExecutor(MailboxExecutor 
mailboxExecutor) {
+               this.mailboxExecutor = mailboxExecutor;
+       }
+
+       @Override public StreamOperator createStreamOperator(StreamTask 
containingTask, StreamConfig config,
+                       Output output) {
+               AsyncWaitOperator asyncWaitOperator = new AsyncWaitOperator(
+                               asyncFunction,
+                               timeout,
+                               capacity,
+                               outputMode,
+                               mailboxExecutor);
+               asyncWaitOperator.setup(containingTask, config, output);
 
 Review comment:
   setup method is no longer needed with `AsyncWaitOperatorFactory` and whole 
`AsyncWaitOperatorFactory` could be cleaned up: all fields could be made non 
`transient` and `final`.
   
   If it's too big clean up to be done within this PR, can you create a ticket 
to do this?

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