tillrohrmann commented on a change in pull request #9832: [FLINK-11843] Bind lifespan of Dispatcher to leader session URL: https://github.com/apache/flink/pull/9832#discussion_r337050692
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/runner/DefaultDispatcherRunner.java ########## @@ -0,0 +1,235 @@ +/* + * 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.dispatcher.runner; + +import org.apache.flink.runtime.clusterframework.ApplicationStatus; +import org.apache.flink.runtime.concurrent.FutureUtils; +import org.apache.flink.runtime.dispatcher.DispatcherGateway; +import org.apache.flink.runtime.leaderelection.LeaderContender; +import org.apache.flink.runtime.leaderelection.LeaderElectionService; +import org.apache.flink.runtime.rpc.FatalErrorHandler; +import org.apache.flink.util.FlinkException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +/** + * Runner for the {@link org.apache.flink.runtime.dispatcher.Dispatcher} which is responsible for the + * leader election. + */ +public class DefaultDispatcherRunner implements DispatcherRunner, LeaderContender { + + private static final Logger LOG = LoggerFactory.getLogger(DefaultDispatcherRunner.class); + + private final Object lock = new Object(); + + private final LeaderElectionService leaderElectionService; + + private final FatalErrorHandler fatalErrorHandler; + + private final DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory; + + private final CompletableFuture<Void> terminationFuture; + + private final CompletableFuture<ApplicationStatus> shutDownFuture; + + private boolean isRunning; Review comment: Fair enough. I'll change it. But I don't think that this is consistently applied in Flink's code base. ---------------------------------------------------------------- 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 With regards, Apache Git Services