public class QuorumStateChangeListenerBase extends Object implements QuorumStateChangeListener
QuorumStateChangeListener
provides NOP method implementations.Constructor and Description |
---|
QuorumStateChangeListenerBase() |
Modifier and Type | Method and Description |
---|---|
void |
consensus(long lastCommitTime)
Invoked when a consensus has been achieved among
(k+1)/2
services concerning a shared lastCommitTime (really, this is not a
consensus but a simple majority). |
void |
lostConsensus()
Invoked when the consensus is lost.
|
void |
memberAdd()
Invoked when this service is added as a quorum member.
|
void |
memberRemove()
Invoked when this service is removed as a quorum member.
|
void |
pipelineAdd()
Invoked when this service is added to the write pipeline.
|
void |
pipelineChange(UUID oldDownStreamId,
UUID newDownStreamId)
Invoked for this service when the downstream service in the write
pipeline has changed.
|
void |
pipelineElectedLeader()
Invoked for this service when the service is already in the pipeline and
this service becomes the first service in the write pipeline because all
previous services in the pipeline order have been removed from the
pipeline (failover into the leader position).
|
void |
pipelineRemove()
Invoked when this service is removed from the write pipeline.
|
void |
pipelineUpstreamChange()
Invoked for this service when the upstream service in the write pipeline
has been removed.
|
void |
quorumBreak()
Invoked when a quorum breaks.
|
void |
quorumMeet(long token,
UUID leaderId)
Invoked when a quorum meets.
|
void |
serviceJoin()
Invoked when this service joins the quorum.
|
void |
serviceLeave()
Invoked when this service leaves the quorum.
|
public void memberAdd()
QuorumStateChangeListener
memberAdd
in interface QuorumStateChangeListener
public void memberRemove()
QuorumStateChangeListener
memberRemove
in interface QuorumStateChangeListener
public void pipelineAdd()
QuorumStateChangeListener
pipelineAdd
in interface QuorumStateChangeListener
public void pipelineRemove()
QuorumStateChangeListener
pipelineRemove
in interface QuorumStateChangeListener
public void pipelineElectedLeader()
QuorumStateChangeListener
pipelineElectedLeader
in interface QuorumStateChangeListener
public void pipelineChange(UUID oldDownStreamId, UUID newDownStreamId)
QuorumStateChangeListener
pipelineChange
in interface QuorumStateChangeListener
public void pipelineUpstreamChange()
QuorumStateChangeListener
pipelineUpstreamChange
in interface QuorumStateChangeListener
public void consensus(long lastCommitTime)
QuorumStateChangeListener
(k+1)/2
services concerning a shared lastCommitTime (really, this is not a
consensus but a simple majority). This message is sent to each member
service regardless of whether or not they participated in the consensus.
Once a consensus has been reached, each QuorumMember
which agrees
on that lastCommitTime MUST do a QuorumStateChangeListener.serviceJoin()
before the
quorum will meet. The first quorum member to do a service join will be
elected the leader. The remaining services to do a service join will be
elected followers.
consensus
in interface QuorumStateChangeListener
lastCommitTime
- The last commit time around which a consensus was established.QuorumStateChangeListener.serviceJoin()
,
#electedLeader(long)
,
#electedFollower(long)
,
QuorumStateChangeListener.lostConsensus()
public void lostConsensus()
QuorumStateChangeListener
lostConsensus
in interface QuorumStateChangeListener
QuorumStateChangeListener.consensus(long)
public void quorumBreak()
QuorumStateChangeListener
quorumBreak
in interface QuorumStateChangeListener
public void serviceJoin()
QuorumStateChangeListener
serviceJoin
in interface QuorumStateChangeListener
public void serviceLeave()
QuorumStateChangeListener
serviceLeave
in interface QuorumStateChangeListener
public void quorumMeet(long token, UUID leaderId)
QuorumStateChangeListener
#isLeader(long)
, joined as a
follower (using #isFollower(long)
), or do not participate
in the quorum (this message is sent to all quorum members, so this
service might not be part of the met qourum).
The following pre-conditions will be satisfied before this message is
sent to the QuorumMember
:
(k+1)/2
services which have voted
for the same lastCommitTime.(k+1)/2
services joined with the
quorum. The join order
will be the same
as the Quorum.getVotes()
for the services which voted for the
lastCommitTimeQuorumStateChangeListener.memberAdd()
, QuorumStateChangeListener.pipelineAdd()
,
QuorumStateChangeListener.consensus(long)
, and QuorumStateChangeListener.serviceJoin()
events.When control returns from this method, the following post-conditions should be true:
QuorumMember
is joined with the quorum but it can not
satisfy these post-conditions, then it must
leave
the Quorum
.quorumMeet
in interface QuorumStateChangeListener
token
- The newly assigned quorum token.leaderId
- The UUID
of the service which was elected to be the
quorum leader. This information is only valid for the scope of
the accompanying quorum token. (The leaderId may be obtained
from #getLeader(long)
at any time for a met quorum.)Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.