public abstract class AbstractQuorumMember<S extends Remote> extends AbstractQuorumClient<S> implements QuorumMember<S>
QuorumMember.log| Modifier | Constructor and Description | 
|---|---|
protected  | 
AbstractQuorumMember(String logicalServiceId,
                    UUID serviceId)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
addListener(QuorumStateChangeListener listener)
Add a delegate listener. 
 | 
protected void | 
assertFollower(long token)  | 
void | 
assertLeader(long token)
Assert that this is the quorum leader. 
 | 
protected void | 
assertQuorum(long token)  | 
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). | 
QuorumActor<S,QuorumMember<S>> | 
getActor()
Return the actor for this  
QuorumMember (it is allocated by
 AbstractQuorum.start(QuorumClient)). | 
UUID | 
getDownstreamServiceId()
Return the  
UUID of the service (if any) downstream from this
 service in the write pipeline. | 
S | 
getLeader(long token)
Return the remote interface used to perform HA operations on the quorum
 leader. 
 | 
abstract S | 
getService(UUID serviceId)
Return the remote interface used to perform HA operations on a member of
 quorum. 
 | 
UUID | 
getServiceId()
The identifier for this service (the quorum member). 
 | 
boolean | 
isFollower(long token)
Return  
true iff this node is a quorum follower. | 
boolean | 
isJoinedMember(long token)
Return  
true if the service is joined with the quorum. | 
boolean | 
isLastInChain(long token)
Return  
true iff the quorum is highly available and this
 node is last one in the write pipeline (it will not return true for a
 singleton quorum where the only node is the master). | 
boolean | 
isLeader(long token)
Return  
true iff this node is the quorum leader. | 
boolean | 
isMember()
Return  
trueif the quorum recognizes the service as a member
 of that quorum. | 
boolean | 
isPipelineMember()
Return  
true if quorum recognizes the service is part of the
 write pipeline. | 
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. 
 | 
protected void | 
removeListener(QuorumStateChangeListener listener)
Remove a delegate listener. 
 | 
void | 
serviceJoin()
Invoked when this service joins the quorum. 
 | 
void | 
serviceLeave()
Invoked when this service leaves the quorum. 
 | 
disconnected, getLogicalServiceZPath, getQuorum, notify, start, terminateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetExecutor, getServicedisconnected, getLogicalServiceZPath, getQuorum, start, terminatenotifypublic S getLeader(long token)
QuorumClientgetLeader in interface QuorumClient<S extends Remote>getLeader in class AbstractQuorumClient<S extends Remote>token - The quorum token for which the request was made.public abstract S getService(UUID serviceId)
QuorumClientgetService in interface QuorumClient<S extends Remote>getService in interface ServiceLookup<S extends Remote>getService in class AbstractQuorumClient<S extends Remote>serviceId - The UUID associated with the service.public UUID getServiceId()
QuorumMembergetServiceId in interface QuorumMember<S extends Remote>QuorumClient.getLogicalServiceZPath()public QuorumActor<S,QuorumMember<S>> getActor()
QuorumMember (it is allocated by
 AbstractQuorum.start(QuorumClient)).getActor in interface QuorumMember<S extends Remote>public boolean isMember()
QuorumMembertrueif the quorum recognizes the service as a member
 of that quorum. The quorum token is not required for this method because
 membership status does not change with a quorum meet or break.isMember in interface QuorumMember<S extends Remote>public boolean isPipelineMember()
QuorumMembertrue if quorum recognizes the service is part of the
 write pipeline. The quorum token is not required for this method because
 pipeline status does not change with a quorum meet or break. Once a
 service is receiving synchronous messages from a Quorum it will
 notice when it enters and leaves the pipeline and when the downstream
 service for this service changes in the quorum.isPipelineMember in interface QuorumMember<S extends Remote>public boolean isJoinedMember(long token)
QuorumMembertrue if the service is joined with the quorum.
 
 Note: This method DOES NOT throw an exception if the quorum is not met,
 but it will not return true unless the quorum is met.
isJoinedMember in interface QuorumMember<S extends Remote>token - The quorum token for which the request was made.public boolean isLeader(long token)
QuorumMembertrue iff this node is the quorum leader. The
 quorum leader is the only node which will accept writes. Note that is
 always true when the #replicationFactor() is ONE
 (1).isLeader in interface QuorumMember<S extends Remote>token - The quorum token for which the request was made.public boolean isFollower(long token)
QuorumMembertrue iff this node is a quorum follower. This is
 true of all nodes in a Q except for the leader.isFollower in interface QuorumMember<S extends Remote>token - The quorum token for which the request was made.public boolean isLastInChain(long token)
QuorumMembertrue iff the quorum is highly available and this
 node is last one in the write pipeline (it will not return true for a
 singleton quorum where the only node is the master).isLastInChain in interface QuorumMember<S extends Remote>token - The quorum token for which the request was made.public UUID getDownstreamServiceId()
QuorumMemberUUID of the service (if any) downstream from this
 service in the write pipeline.getDownstreamServiceId in interface QuorumMember<S extends Remote>null for services which are not part of
         the write pipeline, for the leader, and for the last service in
         the write pipeline.protected void assertQuorum(long token)
public void assertLeader(long token)
QuorumMemberassertLeader in interface QuorumMember<S extends Remote>token - The quorum token for which the request was made.protected void assertFollower(long token)
protected void addListener(QuorumStateChangeListener listener)
listener - The listener.protected void removeListener(QuorumStateChangeListener listener)
listener - The listener.public void memberAdd()
QuorumStateChangeListenermemberAdd in interface QuorumStateChangeListenerpublic void memberRemove()
QuorumStateChangeListenermemberRemove in interface QuorumStateChangeListenerpublic void pipelineAdd()
QuorumStateChangeListenerpipelineAdd in interface QuorumStateChangeListenerpublic void pipelineRemove()
QuorumStateChangeListenerpipelineRemove in interface QuorumStateChangeListenerpublic void pipelineElectedLeader()
QuorumStateChangeListenerpipelineElectedLeader in interface QuorumStateChangeListenerpublic void pipelineChange(UUID oldDownStreamId, UUID newDownStreamId)
QuorumStateChangeListenerpipelineChange in interface QuorumStateChangeListenerpublic void pipelineUpstreamChange()
QuorumStateChangeListenerpipelineUpstreamChange in interface QuorumStateChangeListenerpublic 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 QuorumStateChangeListenerlastCommitTime - The last commit time around which a consensus was established.QuorumStateChangeListener.serviceJoin(), 
#electedLeader(long), 
#electedFollower(long), 
QuorumStateChangeListener.lostConsensus()public void lostConsensus()
QuorumStateChangeListenerlostConsensus in interface QuorumStateChangeListenerQuorumStateChangeListener.consensus(long)public void serviceJoin()
QuorumStateChangeListenerserviceJoin in interface QuorumStateChangeListenerpublic void serviceLeave()
QuorumStateChangeListenerserviceLeave in interface QuorumStateChangeListenerpublic void quorumBreak()
QuorumStateChangeListenerquorumBreak in interface QuorumStateChangeListenerpublic 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 QuorumStateChangeListenertoken - 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.