tillrohrmann commented on a change in pull request #15251:
URL: https://github.com/apache/flink/pull/15251#discussion_r597595042



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/BackgroundTask.java
##########
@@ -0,0 +1,128 @@
+/*
+ * 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.runtime.scheduler.adaptive;
+
+import org.apache.flink.runtime.concurrent.FutureUtils;
+import org.apache.flink.util.FlinkException;
+import org.apache.flink.util.function.SupplierWithException;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.Executor;
+
+/**
+ * BackgroundTask encapsulates an asynchronous operation which can produce a 
result. The result can
+ * be accessed via {@link BackgroundTask#getResultFuture()}. Additionally, the 
task allows to track
+ * its completion via {@link BackgroundTask#getTerminationFuture()}.
+ *
+ * <p>In order to ensure the order of background tasks, one can use the {@link
+ * BackgroundTask#runAfter} to schedule tasks which are executed after this 
task has completed.
+ *
+ * @param <T> type of the produced result
+ */
+final class BackgroundTask<T> {
+    private final CompletableFuture<Void> terminationFuture;
+
+    private final CompletableFuture<T> resultFuture;
+
+    private volatile boolean isValid = true;

Review comment:
       fair enough. I will change it.




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


Reply via email to