LeaderZooKeeperServer (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.quorum

## Class LeaderZooKeeperServer

- java.lang.Object
- - org.apache.zookeeper.server.ZooKeeperServer
  - - org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
    - - org.apache.zookeeper.server.quorum.LeaderZooKeeperServer

- All Implemented Interfaces:
    ServerStats.Provider, SessionTracker.SessionExpirer

      public class LeaderZooKeeperServer
      extends QuorumZooKeeperServer

  Just like the standard ZooKeeperServer. We just replace the request processors: PrepRequestProcessor -> ProposalRequestProcessor -> CommitProcessor -> Leader.ToBeAppliedRequestProcessor -> FinalRequestProcessor

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.zookeeper.server.ZooKeeperServer

      `ZooKeeperServer.MissingSessionException, ZooKeeperServer.State`

  - ### Field Summary

    - ### Fields inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer

      `self, upgradeableSessionTracker`

    - ### Fields inherited from class org.apache.zookeeper.server.ZooKeeperServer

      `ALLOW_SASL_FAILED_CLIENTS, CLOSE_SESSION_TXN_ENABLED, DEFAULT_STARTING_BUFFER_SIZE, DEFAULT_THROTTLED_OP_WAIT_TIME, DEFAULT_TICK_TIME, ENABLE_EAGER_ACL_CHECK, ENFORCE_QUOTA, enforceQuota, firstProcessor, GET_CHILDREN_RESPONSE_CACHE_SIZE, GET_DATA_RESPONSE_CACHE_SIZE, GLOBAL_OUTSTANDING_LIMIT, initialConfig, INT_BUFFER_STARTING_SIZE_BYTES, intBufferStartingSizeBytes, jmxDataTreeBean, jmxServerBean, jvmPauseMonitor, listenBacklog, LOG, maxSessionTimeout, minSessionTimeout, ok, reconfigEnabled, SASL_SUPER_USER, secureServerCnxnFactory, serverCnxnFactory, sessionTracker, SKIP_ACL, SNAP_COUNT, state, throttledOpWaitTime, tickTime, ZOOKEEPER_DIGEST_ENABLED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LeaderZooKeeperServer(FileTxnSnapLog logFactory, QuorumPeer self, ZKDatabase zkDb)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkIfValidGlobalSession(long sess, int to)`
    `void` | `createSessionTracker()`
    `int` | `getGlobalOutstandingLimit()`
    `Leader` | `getLeader()`
    `long` | `getServerId()` Returns the id of the associated QuorumPeer, which will do for a unique id of this server.
    `String` | `getState()`
    `protected void` | `registerJMX()`
    `void` | `registerJMX(LeaderBean leaderBean, LocalPeerBean localPeerBean)`
    `protected void` | `registerMetrics()`
    `protected void` | `revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout)`
    `protected void` | `setupRequestProcessors()`
    `void` | `shutdown()`
    `void` | `startup()`
    `void` | `submitLearnerRequest(Request request)` Requests coming from the learner should go directly to PrepRequestProcessor
    `boolean` | `touch(long sess, int to)`
    `protected void` | `unregisterJMX()`
    `protected void` | `unregisterJMX(Leader leader)`
    `protected void` | `unregisterMetrics()`

    - ### Methods inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer

      `checkUpgradeSession, dumpConf, dumpMonitorValues, setLocalSessionFlag, setState, startSessionTracker, upgrade`

    - ### Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer

      `authWriteRequest, canShutdown, checkACL, checkPasswd, checkQuota, checkRequestSizeWhenReceivingMessage, closeSession, closeSession, connThrottle, decInProcess, dumpEphemerals, enqueueRequest, expire, finishSessionInit, getClientPort, getClientPortListenBacklog, getConf, getConnectionDropChance, getDataDirSize, getEphemerals, getGetChildrenResponseCache, getInflight, getInitialConfig, getInProcess, getLargeRequestBytes, getLargeRequestMaxBytes, getLargeRequestThreshold, getLastProcessedZxid, getLogDirSize, getMaxClientCnxnsPerHost, getMaxSessionTimeout, getMinSessionTimeout, getNumAliveConnections, getOutstandingHandshakeNum, getOutstandingRequests, getReadResponseCache, getRequestPathMetricsCollector, getSecureClientPort, getSecureServerCnxnFactory, getServerCnxnFactory, getSessionExpiryMap, getSessionTracker, getSnapCount, getSnapSizeInBytes, getThrottledOpWaitTime, getTickTime, getTxnLogElapsedSyncTime, getTxnLogFactory, getZKDatabase, getZkShutdownHandler, getZooKeeperServerListener, getZxid, incInProcess, isCloseSessionTxnEnabled, isDigestEnabled, isReconfigEnabled, isResponseCachingEnabled, isRunning, killSession, loadData, processConnectRequest, processPacket, processTxn, processTxn, reopenSession, requestFinished, serverStats, setClientPortListenBacklog, setCloseSessionTxnEnabled, setCreateSessionTrackerServerId, setDigestEnabled, setLargeRequestMaxBytes, setLargeRequestThreshold, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setResponseCachingEnabled, setSecureServerCnxnFactory, setServerCnxnFactory, setThrottledOpWaitTime, setTickTime, setTxnLogFactory, setZKDatabase, setZxid, shouldForceWriteInitialSnapshotAfterLeaderElection, shouldThrottle, shutdown, startdata, startJvmPauseMonitor, startRequestThrottler, startServing, startupWithoutServing, submitRequest, submitRequestNow, takeSnapshot, takeSnapshot, truncateLog, validateSession`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LeaderZooKeeperServer

          public LeaderZooKeeperServer(FileTxnSnapLog logFactory,
                                       QuorumPeer self,
                                       ZKDatabase zkDb)
                                throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getLeader

          public Leader getLeader()

    - #### setupRequestProcessors

          protected void setupRequestProcessors()

      Overrides:
        `setupRequestProcessors` in class `ZooKeeperServer`

    - #### startup

          public void startup()

      Overrides:
        `startup` in class `ZooKeeperServer`

    - #### registerMetrics

          protected void registerMetrics()

      Overrides:
        `registerMetrics` in class `QuorumZooKeeperServer`

    - #### unregisterMetrics

          protected void unregisterMetrics()

      Overrides:
        `unregisterMetrics` in class `QuorumZooKeeperServer`

    - #### shutdown

          public void shutdown()

      Overrides:
        `shutdown` in class `ZooKeeperServer`

    - #### getGlobalOutstandingLimit

          public int getGlobalOutstandingLimit()

      Overrides:
        `getGlobalOutstandingLimit` in class `ZooKeeperServer`

    - #### createSessionTracker

          public void createSessionTracker()

      Overrides:
        `createSessionTracker` in class `ZooKeeperServer`

    - #### touch

          public boolean touch(long sess,
                               int to)

    - #### checkIfValidGlobalSession

          public boolean checkIfValidGlobalSession(long sess,
                                                   int to)

    - #### submitLearnerRequest

          public void submitLearnerRequest(Request request)

      Requests coming from the learner should go directly to PrepRequestProcessor
      Parameters:
        `request` -

    - #### registerJMX

          protected void registerJMX()

      Overrides:
        `registerJMX` in class `ZooKeeperServer`

    - #### registerJMX

          public void registerJMX(LeaderBean leaderBean,
                                  LocalPeerBean localPeerBean)

    - #### unregisterJMX

          protected void unregisterJMX()

      Overrides:
        `unregisterJMX` in class `ZooKeeperServer`

    - #### unregisterJMX

          protected void unregisterJMX(Leader leader)

    - #### getState

          public String getState()

      Specified by:
        `getState` in interface `ServerStats.Provider`
      Overrides:
        `getState` in class `ZooKeeperServer`

    - #### 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`

    - #### revalidateSession

          protected void revalidateSession(ServerCnxn cnxn,
                                           long sessionId,
                                           int sessionTimeout)
                                    throws IOException

      Overrides:
        `revalidateSession` in class `ZooKeeperServer`
      Throws:
        `IOException`

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.