org.apache.zookeeper.server.quorum
Class LearnerZooKeeperServer

java.lang.Object
  extended by org.apache.zookeeper.server.ZooKeeperServer
      extended by org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
          extended by 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
 
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, hzxid, jmxDataTreeBean, jmxServerBean, LOG, maxSessionTimeout, minSessionTimeout, ok, running, sessionTracker, tickTime
 
Constructor Summary
LearnerZooKeeperServer(FileTxnSnapLog logFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, ZKDatabase zkDb, QuorumPeer self)
           
 
Method Summary
protected  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  HashMap<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)
           
protected  void unregisterJMX()
           
protected  void unregisterJMX(Learner peer)
           
 
Methods inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
dumpConf
 
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer
checkPasswd, closeSession, closeSession, decInProcess, dumpEphemerals, expire, finishSessionInit, getClientPort, getGlobalOutstandingLimit, getInProcess, getLastProcessedZxid, getMaxSessionTimeout, getMinSessionTimeout, getOutstandingRequests, getServerCnxnFactory, getSnapCount, getState, getTickTime, getTxnLogFactory, getZKDatabase, getZxid, incInProcess, isRunning, killSession, loadData, processConnectRequest, processPacket, reopenSession, serverStats, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setServerCnxnFactory, setTickTime, setTxnLogFactory, setupRequestProcessors, setZKDatabase, setZxid, shouldThrottle, shutdown, startdata, startup, submitRequest, takeSnapshot, truncateLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LearnerZooKeeperServer

public LearnerZooKeeperServer(FileTxnSnapLog logFactory,
                              int tickTime,
                              int minSessionTimeout,
                              int maxSessionTimeout,
                              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 HashMap<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

protected 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)


Copyright © 2011 The Apache Software Foundation