Class ReadOnlyZooKeeperServer
- java.lang.Object
-
- org.apache.zookeeper.server.ZooKeeperServer
-
- org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
-
- org.apache.zookeeper.server.quorum.ReadOnlyZooKeeperServer
-
- All Implemented Interfaces:
ServerStats.Provider,SessionTracker.SessionExpirer
public class ReadOnlyZooKeeperServer extends QuorumZooKeeperServer
A ZooKeeperServer which comes into play when peer is partitioned from the majority. Handles read-only clients, but drops connections from not-read-only ones.The very first processor in the chain of request processors is a ReadOnlyRequestProcessor which drops state-changing requests.
-
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetServerId()Returns the id of the associated QuorumPeer, which will do for a unique id of this server.java.lang.StringgetState()protected voidregisterJMX()voidregisterJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)protected voidsetState(ZooKeeperServer.State state)Sets the state of ZooKeeper server.protected voidsetupRequestProcessors()voidshutdown()voidstartup()protected voidunregisterJMX()protected voidunregisterJMX(ZooKeeperServer zks)-
Methods inherited from class org.apache.zookeeper.server.quorum.QuorumZooKeeperServer
dumpConf
-
Methods inherited from class org.apache.zookeeper.server.ZooKeeperServer
canShutdown, checkPasswd, closeSession, closeSession, createSessionTracker, decInProcess, dumpEphemerals, expire, finishSessionInit, getClientPort, getGlobalOutstandingLimit, getInProcess, getLastProcessedZxid, getMaxSessionTimeout, getMinSessionTimeout, getNumAliveConnections, getOutstandingRequests, getServerCnxnFactory, getSnapCount, getTickTime, getTxnLogFactory, getZKDatabase, getZooKeeperServerListener, getZxid, incInProcess, isRunning, killSession, loadData, processConnectRequest, processPacket, processTxn, reopenSession, revalidateSession, serverStats, setMaxSessionTimeout, setMinSessionTimeout, setOwner, setServerCnxnFactory, setTickTime, setTxnLogFactory, setZKDatabase, setZxid, shouldThrottle, shutdown, startdata, startSessionTracker, submitRequest, takeSnapshot, truncateLog
-
-
-
-
Method Detail
-
setupRequestProcessors
protected void setupRequestProcessors()
- Overrides:
setupRequestProcessorsin classZooKeeperServer
-
startup
public void startup()
- Overrides:
startupin classZooKeeperServer
-
registerJMX
protected void registerJMX()
- Overrides:
registerJMXin classZooKeeperServer
-
registerJMX
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean)
-
setState
protected void setState(ZooKeeperServer.State state)
Description copied from class:ZooKeeperServerSets the state of ZooKeeper server. After changing the state, it notifies the server state change to a registered shutdown handler, if any.The following are the server state transitions:
- During startup the server will be in the INITIAL state.
- After successfully starting, the server sets the state to RUNNING.
- The server transitions to the ERROR state if it hits an internal error.
ZooKeeperServerListenerImplnotifies any critical resource error events, e.g., SyncRequestProcessor not being able to write a txn to disk.- During shutdown the server sets the state to SHUTDOWN, which corresponds to the server not running.
- Overrides:
setStatein classQuorumZooKeeperServer- Parameters:
state- new server state.
-
unregisterJMX
protected void unregisterJMX()
- Overrides:
unregisterJMXin classZooKeeperServer
-
unregisterJMX
protected void unregisterJMX(ZooKeeperServer zks)
-
getState
public java.lang.String getState()
- Specified by:
getStatein interfaceServerStats.Provider- Overrides:
getStatein classZooKeeperServer
-
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
-
shutdown
public void shutdown()
- Overrides:
shutdownin classZooKeeperServer
-
-