Class ObserverMaster
- java.lang.Object
- 
- org.apache.zookeeper.server.quorum.LearnerMaster
- 
- org.apache.zookeeper.server.quorum.ObserverMaster
 
 
- 
- All Implemented Interfaces:
- Runnable
 
 public class ObserverMaster extends LearnerMaster implements Runnable Used by Followers to host Observers. This reduces the network load on the Leader process by pushing the responsibility for keeping Observers in sync off the leading peer. It is expected that Observers will continue to perform the initial vetting of clients and requests. Observers send the request to the follower where it is received by an ObserverMaster. The ObserverMaster forwards a copy of the request to the ensemble Leader and inserts it into its own request processor pipeline where it can be matched with the response comes back. All commits received from the Leader will be forwarded along to every Learner connected to the ObserverMaster. New Learners connecting to a Follower will receive a LearnerHandler object and be party to its syncing logic to be brought up to date. The logic is quite a bit simpler than the corresponding logic in Leader because it only hosts observers.
- 
- 
Method Summary- 
Methods inherited from class org.apache.zookeeper.server.quorum.LearnerMastergetLearnerDiffSyncThrottler, getLearnerSnapSyncThrottler, getMaxConcurrentDiffSyncs, getMaxConcurrentSnapSyncs, setMaxConcurrentDiffSyncs, setMaxConcurrentSnapSyncs
 
- 
 
- 
- 
- 
Method Detail- 
addLearnerHandlerpublic void addLearnerHandler(LearnerHandler learnerHandler) 
 - 
removeLearnerHandlerpublic void removeLearnerHandler(LearnerHandler learnerHandler) 
 - 
syncTimeoutpublic int syncTimeout() 
 - 
getTickOfNextAckDeadlinepublic int getTickOfNextAckDeadline() 
 - 
getTickOfInitialAckDeadlinepublic int getTickOfInitialAckDeadline() 
 - 
getAndDecrementFollowerCounterpublic long getAndDecrementFollowerCounter() 
 - 
waitForEpochAckpublic void waitForEpochAck(long sid, StateSummary ss) throws IOException, InterruptedException- Throws:
- IOException
- InterruptedException
 
 - 
waitForStartuppublic void waitForStartup() throws InterruptedException- Throws:
- InterruptedException
 
 - 
getLastProposedpublic long getLastProposed() 
 - 
getEpochToProposepublic long getEpochToPropose(long sid, long lastAcceptedEpoch) throws InterruptedException, IOException- Throws:
- InterruptedException
- IOException
 
 - 
getZKDatabasepublic ZKDatabase getZKDatabase() 
 - 
waitForNewLeaderAckpublic void waitForNewLeaderAck(long sid, long zxid) throws InterruptedException- Throws:
- InterruptedException
 
 - 
getCurrentTickpublic int getCurrentTick() 
 - 
processAckpublic void processAck(long sid, long zxid, SocketAddress localSocketAddress)
 - 
touchpublic void touch(long sess, int to)
 - 
revalidateSessionpublic void revalidateSession(QuorumPacket qp, LearnerHandler learnerHandler) throws IOException - Throws:
- IOException
 
 - 
submitLearnerRequestpublic void submitLearnerRequest(Request si) 
 - 
startForwardingpublic long startForwarding(LearnerHandler learnerHandler, long lastSeenZxid) 
 - 
getQuorumVerifierVersionpublic long getQuorumVerifierVersion() 
 - 
getPeerInfopublic String getPeerInfo(long sid) 
 - 
getQuorumVerifierBytespublic byte[] getQuorumVerifierBytes() 
 - 
getQuorumAuthServerpublic QuorumAuthServer getQuorumAuthServer() 
 - 
startpublic void start() throws IOException- Throws:
- IOException
 
 - 
stoppublic void stop() 
 - 
resetObserverConnectionStatspublic void resetObserverConnectionStats() 
 - 
registerLearnerHandlerBeanpublic void registerLearnerHandlerBean(LearnerHandler learnerHandler, Socket socket) 
 - 
unregisterLearnerHandlerBeanpublic void unregisterLearnerHandlerBean(LearnerHandler learnerHandler) 
 
- 
 
-