Class DefaultDispatcherRunner
- java.lang.Object
-
- org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunner
-
- All Implemented Interfaces:
AutoCloseable
,DispatcherRunner
,LeaderContender
,AutoCloseableAsync
public final class DefaultDispatcherRunner extends Object implements DispatcherRunner, LeaderContender
Runner for theDispatcher
which is responsible for the leader election.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
closeAsync()
Trigger the closing of the resource and return the corresponding close future.static DispatcherRunner
create(LeaderElection leaderElection, FatalErrorHandler fatalErrorHandler, DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory)
CompletableFuture<ApplicationStatus>
getShutDownFuture()
Return shut down future of this runner.void
grantLeadership(UUID leaderSessionID)
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader.void
handleError(Exception exception)
Callback method which is called byLeaderElectionService
in case of an error in the service thread.void
revokeLeadership()
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
-
-
-
Method Detail
-
getShutDownFuture
public CompletableFuture<ApplicationStatus> getShutDownFuture()
Description copied from interface:DispatcherRunner
Return shut down future of this runner. The shut down future is being completed with the finalApplicationStatus
once the runner wants to shut down.- Specified by:
getShutDownFuture
in interfaceDispatcherRunner
- Returns:
- future with the final application status
-
closeAsync
public CompletableFuture<Void> closeAsync()
Description copied from interface:AutoCloseableAsync
Trigger the closing of the resource and return the corresponding close future.- Specified by:
closeAsync
in interfaceAutoCloseableAsync
- Returns:
- Future which is completed once the resource has been closed
-
grantLeadership
public void grantLeadership(UUID leaderSessionID)
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadership
in interfaceLeaderContender
- Parameters:
leaderSessionID
- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadership
in interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContender
Callback method which is called byLeaderElectionService
in case of an error in the service thread.- Specified by:
handleError
in interfaceLeaderContender
- Parameters:
exception
- Caught exception
-
create
public static DispatcherRunner create(LeaderElection leaderElection, FatalErrorHandler fatalErrorHandler, DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory) throws Exception
- Throws:
Exception
-
-