Class LearnerZooKeeperServer
- java.lang.Object
-
- org.apache.zookeeper.server.ZooKeeperServer
-
- org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
-
- org.apache.zookeeper.server.quorum.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.zookeeper.server.ZooKeeperServer
ZooKeeperServer.MissingSessionException, ZooKeeperServer.State
-
-
Field Summary
Fields Modifier and Type Field Description protected CommitProcessor
commitProcessor
protected SyncRequestProcessor
syncProcessor
-
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 Description LearnerZooKeeperServer(FileTxnSnapLog logFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int listenBacklog, ZKDatabase zkDb, QuorumPeer self)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
createSessionTracker()
abstract Learner
getLearner()
Abstract method to return the learner associated with this server.long
getServerId()
Returns the id of the associated QuorumPeer, which will do for a unique id of this server.protected Map<Long,Integer>
getTouchSnapshot()
Returns the current state of the session tracker.protected void
registerJMX()
void
registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)
protected void
revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout)
void
shutdown()
protected void
unregisterJMX()
protected void
unregisterJMX(Learner peer)
-
Methods inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
checkUpgradeSession, dumpConf, dumpMonitorValues, registerMetrics, setLocalSessionFlag, setState, startSessionTracker, unregisterMetrics, upgrade
-
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer
authWriteRequest, canShutdown, checkACL, checkPasswd, checkQuota, checkRequestSizeWhenReceivingMessage, closeSession, closeSession, connThrottle, createRequestThrottler, decInProcess, dumpEphemerals, enqueueRequest, expire, expire, finishSessionInit, getClientPort, getClientPortListenBacklog, getConf, getConnectionDropChance, getDataDirSize, getEphemerals, getGetChildrenResponseCache, getGlobalOutstandingLimit, getInflight, getInitialConfig, getInProcess, getLargeRequestBytes, getLargeRequestMaxBytes, getLargeRequestThreshold, getLastProcessedZxid, getLogDirSize, getMaxClientCnxnsPerHost, getMaxSessionTimeout, getMinSessionTimeout, getNumAliveConnections, getOutstandingHandshakeNum, getOutstandingRequests, getReadResponseCache, getRequestPathMetricsCollector, getSecureClientPort, getSecureServerCnxnFactory, getServerCnxnFactory, getSessionExpiryMap, getSessionTracker, getSnapCount, getSnapSizeInBytes, getState, getThrottledOpWaitTime, getTickTime, getTxnLogElapsedSyncTime, getTxnLogFactory, getZKDatabase, getZkShutdownHandler, getZooKeeperServerListener, getZxid, incInProcess, isCloseSessionTxnEnabled, isDigestEnabled, isEnableEagerACLCheck, isReconfigEnabled, isResponseCachingEnabled, isRunning, killSession, loadData, processConnectRequest, processPacket, processTxn, processTxn, reopenSession, requestFinished, serverStats, setClientPortListenBacklog, setCloseSessionTxnEnabled, setCreateSessionTrackerServerId, setDigestEnabled, setEnableEagerACLCheck, setLargeRequestMaxBytes, setLargeRequestThreshold, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setResponseCachingEnabled, setSecureServerCnxnFactory, setServerCnxnFactory, setThrottledOpWaitTime, setTickTime, setTxnLogFactory, setupRequestProcessors, setZKDatabase, setZxid, shouldForceWriteInitialSnapshotAfterLeaderElection, shouldThrottle, shutdown, startdata, startJvmPauseMonitor, startRequestThrottler, startServing, startup, startupWithoutServing, submitRequest, submitRequestNow, takeSnapshot, takeSnapshot, truncateLog, validateSession
-
-
-
-
Field Detail
-
commitProcessor
protected CommitProcessor commitProcessor
-
syncProcessor
protected SyncRequestProcessor syncProcessor
-
-
Constructor Detail
-
LearnerZooKeeperServer
public LearnerZooKeeperServer(FileTxnSnapLog logFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int listenBacklog, ZKDatabase zkDb, QuorumPeer self) throws IOException
- Throws:
IOException
-
-
Method Detail
-
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 interfaceSessionTracker.SessionExpirer
- Overrides:
getServerId
in classZooKeeperServer
-
createSessionTracker
public void createSessionTracker()
- Overrides:
createSessionTracker
in classZooKeeperServer
-
revalidateSession
protected void revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout) throws IOException
- Overrides:
revalidateSession
in classZooKeeperServer
- Throws:
IOException
-
registerJMX
protected void registerJMX()
- Overrides:
registerJMX
in classZooKeeperServer
-
registerJMX
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)
-
unregisterJMX
protected void unregisterJMX()
- Overrides:
unregisterJMX
in classZooKeeperServer
-
unregisterJMX
protected void unregisterJMX(Learner peer)
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classZooKeeperServer
-
-