public final class DefaultDispatcherRunner extends Object implements DispatcherRunner, LeaderContender
Dispatcher
which is responsible for
the leader election.Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
closeAsync()
Trigger the closing of the resource and return the corresponding close future.
|
static DispatcherRunner |
create(LeaderElectionService leaderElectionService,
FatalErrorHandler fatalErrorHandler,
DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory) |
CompletableFuture<ApplicationStatus> |
getShutDownFuture()
Return shut down future of this runner.
|
void |
grantLeadership(UUID leaderSessionID)
Callback method which is called by the
LeaderElectionService upon selecting this
instance as the new leader. |
void |
handleError(Exception exception)
Callback method which is called by
LeaderElectionService in case of an error in the
service thread. |
void |
revokeLeadership()
Callback method which is called by the
LeaderElectionService upon revoking the
leadership of a former leader. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
getDescription
public CompletableFuture<ApplicationStatus> getShutDownFuture()
DispatcherRunner
ApplicationStatus
once the runner wants to shut down.getShutDownFuture
in interface DispatcherRunner
public CompletableFuture<Void> closeAsync()
AutoCloseableAsync
closeAsync
in interface AutoCloseableAsync
public void grantLeadership(UUID leaderSessionID)
LeaderContender
LeaderElectionService
upon selecting this
instance as the new leader. The method is called with the new leader session ID.grantLeadership
in interface LeaderContender
leaderSessionID
- New leader session IDpublic void revokeLeadership()
LeaderContender
LeaderElectionService
upon revoking the
leadership of a former leader. This might happen in case that multiple contenders have been
granted leadership.revokeLeadership
in interface LeaderContender
public void handleError(Exception exception)
LeaderContender
LeaderElectionService
in case of an error in the
service thread.handleError
in interface LeaderContender
exception
- Caught exceptionpublic static DispatcherRunner create(LeaderElectionService leaderElectionService, FatalErrorHandler fatalErrorHandler, DispatcherLeaderProcessFactory dispatcherLeaderProcessFactory) throws Exception
Exception
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.