tillrohrmann commented on a change in pull request #15251: URL: https://github.com/apache/flink/pull/15251#discussion_r597669844
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/BackgroundTaskTest.java ########## @@ -0,0 +1,148 @@ +/* + * 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.core.testutils.FlinkMatchers; +import org.apache.flink.core.testutils.OneShotLatch; +import org.apache.flink.testutils.executor.TestExecutorResource; +import org.apache.flink.util.TestLogger; + +import org.hamcrest.Matchers; +import org.junit.ClassRule; +import org.junit.Test; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** Tests for the {@link BackgroundTask}. */ +public class BackgroundTaskTest extends TestLogger { Review comment: I think the implementation is as you described it. Tasks are independent of each other and if `b1` fails, then `b2` will be executed. The trick is to use the `termination` future which never transports the failure cause but is only completed once the task has completed. -- 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: us...@infra.apache.org