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.BasicDataTreeBuilder, ZooKeeperServer.DataTreeBuilder, ZooKeeperServer.MissingSessionException, ZooKeeperServer.State
-
-
Field Summary
-
Fields inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
self
-
Fields inherited from class org.apache.zookeeper.server.ZooKeeperServer
DEFAULT_TICK_TIME, firstProcessor, jmxDataTreeBean, jmxServerBean, LOG, maxSessionTimeout, minSessionTimeout, ok, sessionTracker, state, tickTime
-
-
Constructor Summary
Constructors Constructor Description LearnerZooKeeperServer(FileTxnSnapLog logFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, ZooKeeperServer.DataTreeBuilder treeBuilder, ZKDatabase zkDb, QuorumPeer self)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcreateSessionTracker()abstract LearnergetLearner()Abstract method to return the learner associated with this server.longgetServerId()Returns the id of the associated QuorumPeer, which will do for a unique id of this server.protected java.util.HashMap<java.lang.Long,java.lang.Integer>getTouchSnapshot()Returns the current state of the session tracker.protected voidregisterJMX()voidregisterJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)protected voidrevalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout)protected voidstartSessionTracker()protected voidunregisterJMX()protected voidunregisterJMX(Learner peer)-
Methods inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
dumpConf, setState
-
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer
canShutdown, checkPasswd, closeSession, closeSession, decInProcess, dumpEphemerals, expire, finishSessionInit, getClientPort, getGlobalOutstandingLimit, getInProcess, getLastProcessedZxid, getMaxSessionTimeout, getMinSessionTimeout, getNumAliveConnections, getOutstandingRequests, getServerCnxnFactory, getSnapCount, getState, getTickTime, getTxnLogFactory, getZKDatabase, getZooKeeperServerListener, getZxid, incInProcess, isRunning, killSession, loadData, processConnectRequest, processPacket, processTxn, reopenSession, serverStats, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setServerCnxnFactory, setTickTime, setTxnLogFactory, setupRequestProcessors, setZKDatabase, setZxid, shouldThrottle, shutdown, shutdown, startdata, startup, submitRequest, takeSnapshot, truncateLog
-
-
-
-
Constructor Detail
-
LearnerZooKeeperServer
public LearnerZooKeeperServer(FileTxnSnapLog logFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, ZooKeeperServer.DataTreeBuilder treeBuilder, ZKDatabase zkDb, QuorumPeer self) throws java.io.IOException
- Throws:
java.io.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 java.util.HashMap<java.lang.Long,java.lang.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:
getServerIdin interfaceSessionTracker.SessionExpirer- Overrides:
getServerIdin classZooKeeperServer
-
createSessionTracker
public void createSessionTracker()
- Overrides:
createSessionTrackerin classZooKeeperServer
-
startSessionTracker
protected void startSessionTracker()
- Overrides:
startSessionTrackerin classZooKeeperServer
-
revalidateSession
protected void revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout) throws java.io.IOException
- Overrides:
revalidateSessionin classZooKeeperServer- Throws:
java.io.IOException
-
registerJMX
protected void registerJMX()
- Overrides:
registerJMXin classZooKeeperServer
-
registerJMX
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)
-
unregisterJMX
protected void unregisterJMX()
- Overrides:
unregisterJMXin classZooKeeperServer
-
unregisterJMX
protected void unregisterJMX(Learner peer)
-
-