Class DefaultDispatcherRunner
- java.lang.Object
-
- org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunner
-
- All Implemented Interfaces:
AutoCloseable,DispatcherRunner,LeaderContender,org.apache.flink.util.AutoCloseableAsync
public final class DefaultDispatcherRunner extends Object implements DispatcherRunner, LeaderContender
Runner for theDispatcherwhich is responsible for the leader election.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>closeAsync()static DispatcherRunnercreate(LeaderElection leaderElection, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler, DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory)CompletableFuture<ApplicationStatus>getShutDownFuture()Return shut down future of this runner.voidgrantLeadership(UUID leaderSessionID)Callback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader.voidhandleError(Exception exception)Callback method which is called byLeaderElectionServicein case of an error in the service thread.voidrevokeLeadership()Callback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader.
-
-
-
Method Detail
-
getShutDownFuture
public CompletableFuture<ApplicationStatus> getShutDownFuture()
Description copied from interface:DispatcherRunnerReturn shut down future of this runner. The shut down future is being completed with the finalApplicationStatusonce the runner wants to shut down.- Specified by:
getShutDownFuturein interfaceDispatcherRunner- Returns:
- future with the final application status
-
closeAsync
public CompletableFuture<Void> closeAsync()
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync
-
grantLeadership
public void grantLeadership(UUID leaderSessionID)
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadershipin interfaceLeaderContender- Parameters:
leaderSessionID- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadershipin interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContenderCallback method which is called byLeaderElectionServicein case of an error in the service thread.- Specified by:
handleErrorin interfaceLeaderContender- Parameters:
exception- Caught exception
-
create
public static DispatcherRunner create(LeaderElection leaderElection, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler, DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory) throws Exception
- Throws:
Exception
-
-