org.apache.zookeeper.server.quorum
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
Fields inherited from class org.apache.zookeeper.server.ZooKeeperServer |
DEFAULT_TICK_TIME, firstProcessor, hzxid, jmxDataTreeBean, jmxServerBean, LOG, maxSessionTimeout, minSessionTimeout, ok, running, sessionTracker, tickTime |
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer |
byteBuffer2Record, checkPasswd, closeSession, closeSession, decInProcess, dumpEphemerals, expire, getClientPort, getGlobalOutstandingLimit, getInProcess, getLastProcessedZxid, getMaxSessionTimeout, getMinSessionTimeout, getOutstandingRequests, getServerCnxnFactory, getSnapCount, getState, getTickTime, getTxnLogFactory, getZKDatabase, getZxid, incInProcess, isRunning, killSession, loadData, reopenSession, serverStats, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setServerCnxnFactory, setTickTime, setTxnLogFactory, setupRequestProcessors, setZKDatabase, setZxid, shutdown, startdata, startup, submitRequest, takeSnapshot, truncateLog |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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:
getServerId
in interface SessionTracker.SessionExpirer
- Overrides:
getServerId
in class ZooKeeperServer
createSessionTracker
protected void createSessionTracker()
- Overrides:
createSessionTracker
in class ZooKeeperServer
revalidateSession
protected void revalidateSession(ServerCnxn cnxn,
long sessionId,
int sessionTimeout)
throws java.io.IOException,
java.lang.InterruptedException
- Overrides:
revalidateSession
in class ZooKeeperServer
- Throws:
java.io.IOException
java.lang.InterruptedException
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)
Copyright © 2011 The Apache Software Foundation