Class LearnerZooKeeperServer

All Implemented Interfaces:
ServerStats.Provider, SessionTracker.SessionExpirer
Direct Known Subclasses:
FollowerZooKeeperServer, ObserverZooKeeperServer

public abstract class LearnerZooKeeperServer extends QuorumZooKeeperServer
Parent class for all ZooKeeperServers for Learners
  • Field Details

  • Constructor Details

  • Method Details

    • getLearner

      public abstract Learner getLearner()
      Abstract method to return the learner associated with this server. Since the Learner may change under our feet (when QuorumPeer reassigns it) we can't simply take a reference here. Instead, we need the subclasses to implement this.
    • getTouchSnapshot

      protected Map<Long,Integer> getTouchSnapshot()
      Returns the current state of the session tracker. This is only currently used by a Learner to build a ping response packet.
    • getServerId

      public long getServerId()
      Returns the id of the associated QuorumPeer, which will do for a unique id of this server.
      Specified by:
      getServerId in interface SessionTracker.SessionExpirer
      Overrides:
      getServerId in class ZooKeeperServer
    • createSessionTracker

      public void createSessionTracker()
      Overrides:
      createSessionTracker in class ZooKeeperServer
    • revalidateSession

      protected void revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout) throws IOException
      Overrides:
      revalidateSession in class ZooKeeperServer
      Throws:
      IOException
    • registerJMX

      protected void registerJMX()
      Overrides:
      registerJMX in class ZooKeeperServer
    • registerJMX

      public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)
    • unregisterJMX

      protected void unregisterJMX()
      Overrides:
      unregisterJMX in class ZooKeeperServer
    • unregisterJMX

      protected void unregisterJMX(Learner peer)
    • shutdown

      public void shutdown(boolean fullyShutDown)
      Description copied from class: ZooKeeperServer
      Shut down the server instance
      Overrides:
      shutdown in class ZooKeeperServer
      Parameters:
      fullyShutDown - true if another server using the same database will not replace this one in the same process