org.apache.zookeeper.server.quorum
Class FollowerZooKeeperServer

java.lang.Object
  extended by org.apache.zookeeper.server.ZooKeeperServer
      extended by org.apache.zookeeper.server.quorum.FollowerZooKeeperServer
All Implemented Interfaces:
ServerStats.Provider, SessionTracker.SessionExpirer

public class FollowerZooKeeperServer
extends ZooKeeperServer

Just like the standard ZooKeeperServer. We just replace the request processors: FollowerRequestProcessor -> CommitProcessor -> FinalRequestProcessor A SyncRequestProcessor is also spawn off to log proposals from the leader.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.zookeeper.server.ZooKeeperServer
ZooKeeperServer.BasicDataTreeBuilder, ZooKeeperServer.DataTreeBuilder, ZooKeeperServer.Factory
 
Field Summary
 
Fields inherited from class org.apache.zookeeper.server.ZooKeeperServer
commitLogBuffer, commitLogCount, committedLog, dataTree, DEFAULT_TICK_TIME, firstProcessor, hzxid, jmxDataTreeBean, jmxServerBean, maxCommittedLog, minCommittedLog, ok, running, sessionsWithTimeouts, sessionTracker, tickTime
 
Method Summary
 void addCommittedProposal(Request r)
          Do not do anything in the follower.
 void commit(long zxid)
           
protected  void createSessionTracker()
           
 Follower getFollower()
           
 int getGlobalOutstandingLimit()
           
 long getServerId()
           
 String getState()
           
 HashMap<Long,Integer> getTouchSnapshot()
           
 void logRequest(org.apache.zookeeper.txn.TxnHeader hdr, Record txn)
           
protected  void registerJMX()
           
 void registerJMX(FollowerBean followerBean, LocalPeerBean localPeerBean)
           
protected  void revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout)
           
protected  void setupRequestProcessors()
           
 void shutdown()
           
 void sync()
           
protected  void unregisterJMX()
           
protected  void unregisterJMX(Follower follower)
           
 
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer
byteBuffer2Record, checkPasswd, closeSession, closeSession, decInProcess, deserializeSnapshot, expire, getClientPort, getInProcess, getLastProcessedZxid, getLogWriter, getOutstandingRequests, getServerCnxnFactory, getSnapCount, getTickTime, getTreeBuilder, getTxnLogFactory, getZxid, incInProcess, isRunning, killSession, loadData, reopenSession, serializeSnapshot, serverStats, setOwner, setServerCnxnFactory, setTickTime, setTreeBuilder, setTxnLogFactory, setZxid, startup, submitRequest, takeSnapshot, truncateLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFollower

public Follower getFollower()

createSessionTracker

protected void createSessionTracker()
Overrides:
createSessionTracker in class ZooKeeperServer

setupRequestProcessors

protected void setupRequestProcessors()
Overrides:
setupRequestProcessors in class ZooKeeperServer

revalidateSession

protected void revalidateSession(ServerCnxn cnxn,
                                 long sessionId,
                                 int sessionTimeout)
                          throws IOException,
                                 InterruptedException
Overrides:
revalidateSession in class ZooKeeperServer
Throws:
IOException
InterruptedException

getTouchSnapshot

public HashMap<Long,Integer> getTouchSnapshot()

getServerId

public long getServerId()
Specified by:
getServerId in interface SessionTracker.SessionExpirer
Overrides:
getServerId in class ZooKeeperServer

logRequest

public void logRequest(org.apache.zookeeper.txn.TxnHeader hdr,
                       Record txn)

commit

public void commit(long zxid)

sync

public void sync()

getGlobalOutstandingLimit

public int getGlobalOutstandingLimit()
Overrides:
getGlobalOutstandingLimit in class ZooKeeperServer

addCommittedProposal

public void addCommittedProposal(Request r)
Do not do anything in the follower.

Overrides:
addCommittedProposal in class ZooKeeperServer
Parameters:
r - committed request

shutdown

public void shutdown()
Overrides:
shutdown in class ZooKeeperServer

registerJMX

protected void registerJMX()
Overrides:
registerJMX in class ZooKeeperServer

registerJMX

public void registerJMX(FollowerBean followerBean,
                        LocalPeerBean localPeerBean)

unregisterJMX

protected void unregisterJMX()
Overrides:
unregisterJMX in class ZooKeeperServer

unregisterJMX

protected void unregisterJMX(Follower follower)

getState

public String getState()
Specified by:
getState in interface ServerStats.Provider
Overrides:
getState in class ZooKeeperServer