Class ElectionCandidate.Null
java.lang.Object
io.deephaven.enterprise.etcdclient.election.ElectionCandidate.Null
- All Implemented Interfaces:
ElectionCandidate
- Enclosing interface:
- ElectionCandidate
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.enterprise.etcdclient.election.ElectionCandidate
ElectionCandidate.Null -
Field Summary
Fields inherited from interface io.deephaven.enterprise.etcdclient.election.ElectionCandidate
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this object.io.deephaven.shadow.jetcd.io.etcd.jetcd.ByteSequenceGet the leadership opaque key associated to us having leadership, or null if we are not the leader.booleanisLeader()booleanRegister our address in DH Resolver.voidresign()Resign from this election and remove any DH Resolver registration.voidsetLostLeadershipCb(Runnable lostLeadershipCb) Set a new lost leadership callback, replacing the previously assigned one during construction.
-
Constructor Details
-
Null
public Null()
-
-
Method Details
-
setLostLeadershipCb
Description copied from interface:ElectionCandidateSet a new lost leadership callback, replacing the previously assigned one during construction. Note that if at the time this call is made leadership is already lost, the callback will be invoked from inside this method activation.- Specified by:
setLostLeadershipCbin interfaceElectionCandidate- Parameters:
lostLeadershipCb- a callback to run when leadership is lost.
-
register
Description copied from interface:ElectionCandidateRegister our address in DH Resolver. The registration is done as an etcd transaction conditional on our leadership key- Specified by:
registerin interfaceElectionCandidate- Parameters:
service- the service for the registrationport- the port for the registration- Returns:
- true if the registration succeeded in etcd, false otherwise, which implies leadership was lost.
-
isLeader
public boolean isLeader()- Specified by:
isLeaderin interfaceElectionCandidate- Returns:
- true if we are still the leader.
-
getLeadershipKey
public io.deephaven.shadow.jetcd.io.etcd.jetcd.ByteSequence getLeadershipKey()Description copied from interface:ElectionCandidateGet the leadership opaque key associated to us having leadership, or null if we are not the leader. This key can be used transactionally to do other operations conditional on us still being the leader.- Specified by:
getLeadershipKeyin interfaceElectionCandidate- Returns:
- the leadership key
-
resign
public void resign()Description copied from interface:ElectionCandidateResign from this election and remove any DH Resolver registration.- Specified by:
resignin interfaceElectionCandidate
-
close
public void close()Description copied from interface:ElectionCandidateClose this object. Implies resigning if already leader.- Specified by:
closein interfaceElectionCandidate
-