Class 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 Detail

      • addLearnerHandler

        public void addLearnerHandler​(LearnerHandler learnerHandler)
      • removeLearnerHandler

        public void removeLearnerHandler​(LearnerHandler learnerHandler)
      • syncTimeout

        public int syncTimeout()
      • getTickOfNextAckDeadline

        public int getTickOfNextAckDeadline()
      • getTickOfInitialAckDeadline

        public int getTickOfInitialAckDeadline()
      • getAndDecrementFollowerCounter

        public long getAndDecrementFollowerCounter()
      • getLastProposed

        public long getLastProposed()
      • getZKDatabase

        public ZKDatabase getZKDatabase()
      • getCurrentTick

        public int getCurrentTick()
      • processAck

        public void processAck​(long sid,
                               long zxid,
                               SocketAddress localSocketAddress)
      • touch

        public void touch​(long sess,
                          int to)
      • submitLearnerRequest

        public void submitLearnerRequest​(Request si)
      • startForwarding

        public long startForwarding​(LearnerHandler learnerHandler,
                                    long lastSeenZxid)
      • getQuorumVerifierVersion

        public long getQuorumVerifierVersion()
      • getPeerInfo

        public String getPeerInfo​(long sid)
      • getQuorumVerifierBytes

        public byte[] getQuorumVerifierBytes()
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • stop

        public void stop()
      • resetObserverConnectionStats

        public void resetObserverConnectionStats()
      • registerLearnerHandlerBean

        public void registerLearnerHandlerBean​(LearnerHandler learnerHandler,
                                               Socket socket)
      • unregisterLearnerHandlerBean

        public void unregisterLearnerHandlerBean​(LearnerHandler learnerHandler)