Package org.apache.zookeeper.server
Class ZooKeeperServer
- java.lang.Object
- 
- org.apache.zookeeper.server.ZooKeeperServer
 
- 
- All Implemented Interfaces:
- ServerStats.Provider,- SessionTracker.SessionExpirer
 - Direct Known Subclasses:
- QuorumZooKeeperServer,- ReadOnlyZooKeeperServer
 
 public class ZooKeeperServer extends Object implements SessionTracker.SessionExpirer, ServerStats.Provider This class implements a simple standalone ZooKeeperServer. It sets up the following chain of RequestProcessors to process requests: PrepRequestProcessor -> SyncRequestProcessor -> FinalRequestProcessor
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classZooKeeperServer.MissingSessionExceptionprotected static classZooKeeperServer.State
 - 
Field Summary
 - 
Constructor SummaryConstructors Constructor Description ZooKeeperServer()Creates a ZooKeeperServer instance.ZooKeeperServer(File snapDir, File logDir, int tickTime)This constructor is for backward compatibility with the existing unit test code.ZooKeeperServer(FileTxnSnapLog txnLogFactory)Default constructor, relies on the config for its argument valuesZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig)Keeping this constructor for backward compatibilityZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig, boolean reconfigEnabled)* Creates a ZooKeeperServer instance.ZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, String initialConfig)creates a zookeeperserver instance.ZooKeeperServer(JvmPauseMonitor jvmPauseMonitor, FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig)Adds JvmPauseMonitor and callsZooKeeperServer(FileTxnSnapLog, int, int, int, int, ZKDatabase, String)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthWriteRequest(Request request)Check Write Requests for Potential Access Restrictionsprotected booleancanShutdown()This can be used while shutting down the server to see whether the server is already shutdown or not.voidcheckACL(ServerCnxn cnxn, List<ACL> acl, int perm, List<Id> ids, String path, List<ACL> setAcls)Grant or deny authorization to an operation on a node as a function of:protected booleancheckPasswd(long sessionId, byte[] passwd)voidcheckQuota(String path, byte[] lastData, byte[] data, int type)check a path whether exceeded the quota.booleancheckRequestSizeWhenReceivingMessage(int length)voidcloseSession(long sessionId)voidcloseSession(ServerCnxn cnxn, RequestHeader requestHeader)BlueThrottleconnThrottle()protected RequestThrottlercreateRequestThrottler()protected voidcreateSessionTracker()voiddecInProcess()voiddumpConf(PrintWriter pwriter)voiddumpEphemerals(PrintWriter pwriter)voiddumpMonitorValues(BiConsumer<String,Object> response)Hook into admin server, useful to expose additional data that do not represent metrics.voidenqueueRequest(Request si)voidexpire(long sessionId)voidexpire(SessionTracker.Session session)voidfinishSessionInit(ServerCnxn cnxn, boolean valid)intgetClientPort()intgetClientPortListenBacklog()ZooKeeperServerConfgetConf()doublegetConnectionDropChance()longgetDataDirSize()Map<Long,Set<String>>getEphemerals()ResponseCachegetGetChildrenResponseCache()intgetGlobalOutstandingLimit()intgetInflight()StringgetInitialConfig()intgetInProcess()intgetLargeRequestBytes()intgetLargeRequestMaxBytes()intgetLargeRequestThreshold()longgetLastProcessedZxid()return the last processed id from the datatreelonggetLogDirSize()intgetMaxClientCnxnsPerHost()Maximum number of connections allowed from particular host (ip)intgetMaxSessionTimeout()intgetMinSessionTimeout()intgetNumAliveConnections()return the total number of client connections that are alive to this serverintgetOutstandingHandshakeNum()longgetOutstandingRequests()return the outstanding requests in the queue, which haven't been processed yetResponseCachegetReadResponseCache()RequestPathMetricsCollectorgetRequestPathMetricsCollector()intgetSecureClientPort()ServerCnxnFactorygetSecureServerCnxnFactory()ServerCnxnFactorygetServerCnxnFactory()longgetServerId()Map<Long,Set<Long>>getSessionExpiryMap()SessionTrackergetSessionTracker()static intgetSnapCount()static longgetSnapSizeInBytes()StringgetState()static intgetThrottledOpWaitTime()intgetTickTime()longgetTxnLogElapsedSyncTime()Returns the elapsed sync of time of transaction log in milliseconds.FileTxnSnapLoggetTxnLogFactory()ZKDatabasegetZKDatabase()get the zookeeper database for this serverZooKeeperServerShutdownHandlergetZkShutdownHandler()ZooKeeperServerListenergetZooKeeperServerListener()longgetZxid()voidincInProcess()static booleanisCloseSessionTxnEnabled()static booleanisDigestEnabled()static booleanisEnableEagerACLCheck()booleanisReconfigEnabled()booleanisResponseCachingEnabled()booleanisRunning()static booleanisSerializeLastProcessedZxidEnabled()protected voidkillSession(long sessionId, long zxid)voidloadData()Restore sessions and datavoidprocessConnectRequest(ServerCnxn cnxn, ConnectRequest request)voidprocessPacket(ServerCnxn cnxn, RequestHeader h, RequestRecord request)DataTree.ProcessTxnResultprocessTxn(Request request)DataTree.ProcessTxnResultprocessTxn(TxnHeader hdr, Record txn)protected voidregisterJMX()protected voidregisterMetrics()voidreopenSession(ServerCnxn cnxn, long sessionId, byte[] passwd, int sessionTimeout)voidrequestFinished(Request request)longrestoreFromSnapshot(InputStream inputStream)Restores database from a snapshot.protected voidrevalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout)ServerStatsserverStats()voidsetClientPortListenBacklog(int backlog)static voidsetCloseSessionTxnEnabled(boolean enabled)voidsetCreateSessionTrackerServerId(int newId)Change the server ID used bycreateSessionTracker().static voidsetDigestEnabled(boolean digestEnabled)static voidsetEnableEagerACLCheck(boolean enabled)voidsetLargeRequestMaxBytes(int bytes)voidsetLargeRequestThreshold(int threshold)protected voidsetLocalSessionFlag(Request si)If the underlying Zookeeper server support local session, this method will set a isLocalSession to true if a request is associated with a local session.voidsetMaxSessionTimeout(int max)voidsetMinSessionTimeout(int min)voidsetOwner(long id, Object owner)set the owner of this session as ownervoidsetResponseCachingEnabled(boolean isEnabled)voidsetSecureServerCnxnFactory(ServerCnxnFactory factory)static voidsetSerializeLastProcessedZxidEnabled(boolean serializeLastZxidEnabled)voidsetServerCnxnFactory(ServerCnxnFactory factory)protected voidsetState(ZooKeeperServer.State state)Sets the state of ZooKeeper server.static voidsetThrottledOpWaitTime(int time)voidsetTickTime(int tickTime)voidsetTxnLogFactory(FileTxnSnapLog txnLog)protected voidsetupRequestProcessors()voidsetZKDatabase(ZKDatabase zkDb)set the zkdatabase for this zookeeper servervoidsetZxid(long zxid)booleanshouldForceWriteInitialSnapshotAfterLeaderElection()booleanshouldThrottle(long outStandingCount)voidshutdown()voidshutdown(boolean fullyShutDown)Shut down the server instancevoidstartdata()protected voidstartJvmPauseMonitor()protected voidstartRequestThrottler()voidstartServing()protected voidstartSessionTracker()voidstartup()voidstartupWithoutServing()voidsubmitRequest(Request si)voidsubmitRequestNow(Request si)FiletakeSnapshot()FiletakeSnapshot(boolean syncSnap)FiletakeSnapshot(boolean syncSnap, boolean isSevere, boolean fastForwardFromEdits)Takes a snapshot on the server.voidtruncateLog(long zxid)truncate the log to get in sync with others if in a quorumprotected voidunregisterJMX()protected voidunregisterMetrics()protected voidvalidateSession(ServerCnxn cnxn, long sessionId)Validate if a particular session can be reestablished.
 
- 
- 
- 
Field Detail- 
LOGprotected static final org.slf4j.Logger LOG 
 - 
GLOBAL_OUTSTANDING_LIMITpublic static final String GLOBAL_OUTSTANDING_LIMIT - See Also:
- Constant Field Values
 
 - 
ENABLE_EAGER_ACL_CHECKpublic static final String ENABLE_EAGER_ACL_CHECK - See Also:
- Constant Field Values
 
 - 
SKIP_ACLpublic static final String SKIP_ACL - See Also:
- Constant Field Values
 
 - 
ENFORCE_QUOTApublic static final String ENFORCE_QUOTA - See Also:
- Constant Field Values
 
 - 
enforceQuotapublic static final boolean enforceQuota 
 - 
SASL_SUPER_USERpublic static final String SASL_SUPER_USER - See Also:
- Constant Field Values
 
 - 
ALLOW_SASL_FAILED_CLIENTSpublic static final String ALLOW_SASL_FAILED_CLIENTS - See Also:
- Constant Field Values
 
 - 
ZOOKEEPER_DIGEST_ENABLEDpublic static final String ZOOKEEPER_DIGEST_ENABLED - See Also:
- Constant Field Values
 
 - 
ZOOKEEPER_SERIALIZE_LAST_PROCESSED_ZXID_ENABLEDpublic static final String ZOOKEEPER_SERIALIZE_LAST_PROCESSED_ZXID_ENABLED - See Also:
- Constant Field Values
 
 - 
CLOSE_SESSION_TXN_ENABLEDpublic static final String CLOSE_SESSION_TXN_ENABLED - See Also:
- Constant Field Values
 
 - 
jmxServerBeanprotected ZooKeeperServerBean jmxServerBean 
 - 
jmxDataTreeBeanprotected DataTreeBean jmxDataTreeBean 
 - 
DEFAULT_TICK_TIMEpublic static final int DEFAULT_TICK_TIME - See Also:
- Constant Field Values
 
 - 
tickTimeprotected int tickTime 
 - 
DEFAULT_THROTTLED_OP_WAIT_TIMEpublic static final int DEFAULT_THROTTLED_OP_WAIT_TIME - See Also:
- Constant Field Values
 
 - 
throttledOpWaitTimeprotected static volatile int throttledOpWaitTime 
 - 
minSessionTimeoutprotected int minSessionTimeout value of -1 indicates unset, use default
 - 
maxSessionTimeoutprotected int maxSessionTimeout value of -1 indicates unset, use default
 - 
listenBacklogprotected int listenBacklog Socket listen backlog. Value of -1 indicates unset
 - 
sessionTrackerprotected SessionTracker sessionTracker 
 - 
okpublic static final Exception ok 
 - 
firstProcessorprotected RequestProcessor firstProcessor 
 - 
jvmPauseMonitorprotected JvmPauseMonitor jvmPauseMonitor 
 - 
stateprotected volatile ZooKeeperServer.State state 
 - 
initialConfigprotected String initialConfig 
 - 
reconfigEnabledprotected boolean reconfigEnabled 
 - 
serverCnxnFactoryprotected ServerCnxnFactory serverCnxnFactory 
 - 
secureServerCnxnFactoryprotected ServerCnxnFactory secureServerCnxnFactory 
 - 
INT_BUFFER_STARTING_SIZE_BYTESpublic static final String INT_BUFFER_STARTING_SIZE_BYTES Starting size of read and write ByteArroyOuputBuffers. Default is 32 bytes. Flag not used for small transfers like connectResponses.- See Also:
- Constant Field Values
 
 - 
DEFAULT_STARTING_BUFFER_SIZEpublic static final int DEFAULT_STARTING_BUFFER_SIZE - See Also:
- Constant Field Values
 
 - 
intBufferStartingSizeBytespublic static final int intBufferStartingSizeBytes 
 - 
GET_DATA_RESPONSE_CACHE_SIZEpublic static final String GET_DATA_RESPONSE_CACHE_SIZE - See Also:
- Constant Field Values
 
 - 
GET_CHILDREN_RESPONSE_CACHE_SIZEpublic static final String GET_CHILDREN_RESPONSE_CACHE_SIZE - See Also:
- Constant Field Values
 
 - 
SNAP_COUNTpublic static final String SNAP_COUNT - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
ZooKeeperServerpublic ZooKeeperServer() Creates a ZooKeeperServer instance. Nothing is setup, use the setX methods to prepare the instance (eg datadir, datalogdir, ticktime, builder, etc...)
 - 
ZooKeeperServerpublic ZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig) Keeping this constructor for backward compatibility
 - 
ZooKeeperServerpublic ZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig, boolean reconfigEnabled) * Creates a ZooKeeperServer instance. It sets everything up, but doesn't actually start listening for clients until run() is invoked.
 - 
ZooKeeperServerpublic ZooKeeperServer(JvmPauseMonitor jvmPauseMonitor, FileTxnSnapLog txnLogFactory, int tickTime, int minSessionTimeout, int maxSessionTimeout, int clientPortListenBacklog, ZKDatabase zkDb, String initialConfig) Adds JvmPauseMonitor and callsZooKeeperServer(FileTxnSnapLog, int, int, int, int, ZKDatabase, String)
 - 
ZooKeeperServerpublic ZooKeeperServer(FileTxnSnapLog txnLogFactory, int tickTime, String initialConfig) creates a zookeeperserver instance.- Parameters:
- txnLogFactory- the file transaction snapshot logging class
- tickTime- the ticktime for the server
- Throws:
- IOException
 
 - 
ZooKeeperServerpublic ZooKeeperServer(File snapDir, File logDir, int tickTime) throws IOException This constructor is for backward compatibility with the existing unit test code. It defaults to FileLogProvider persistence provider.- Throws:
- IOException
 
 - 
ZooKeeperServerpublic ZooKeeperServer(FileTxnSnapLog txnLogFactory) throws IOException Default constructor, relies on the config for its argument values- Throws:
- IOException
 
 
- 
 - 
Method Detail- 
isEnableEagerACLCheckpublic static boolean isEnableEagerACLCheck() 
 - 
setEnableEagerACLCheckpublic static void setEnableEagerACLCheck(boolean enabled) 
 - 
isCloseSessionTxnEnabledpublic static boolean isCloseSessionTxnEnabled() 
 - 
setCloseSessionTxnEnabledpublic static void setCloseSessionTxnEnabled(boolean enabled) 
 - 
getInitialConfigpublic String getInitialConfig() 
 - 
serverStatspublic ServerStats serverStats() 
 - 
getRequestPathMetricsCollectorpublic RequestPathMetricsCollector getRequestPathMetricsCollector() 
 - 
connThrottlepublic BlueThrottle connThrottle() 
 - 
dumpConfpublic void dumpConf(PrintWriter pwriter) 
 - 
getConfpublic ZooKeeperServerConf getConf() 
 - 
getZKDatabasepublic ZKDatabase getZKDatabase() get the zookeeper database for this server- Returns:
- the zookeeper database for this server
 
 - 
setZKDatabasepublic void setZKDatabase(ZKDatabase zkDb) set the zkdatabase for this zookeeper server- Parameters:
- zkDb-
 
 - 
loadDatapublic void loadData() throws IOException, InterruptedExceptionRestore sessions and data- Throws:
- IOException
- InterruptedException
 
 - 
takeSnapshotpublic File takeSnapshot() throws IOException - Throws:
- IOException
 
 - 
takeSnapshotpublic File takeSnapshot(boolean syncSnap) throws IOException - Throws:
- IOException
 
 - 
takeSnapshotpublic File takeSnapshot(boolean syncSnap, boolean isSevere, boolean fastForwardFromEdits) throws IOException Takes a snapshot on the server.- Parameters:
- syncSnap- syncSnap sync the snapshot immediately after write
- isSevere- if true system exist, otherwise throw IOException
- fastForwardFromEdits- whether fast forward database to the latest recorded transactions
- Returns:
- file snapshot file object
- Throws:
- IOException
 
 - 
restoreFromSnapshotpublic long restoreFromSnapshot(InputStream inputStream) throws IOException Restores database from a snapshot. It is used by the restore admin server command.- Parameters:
- inputStream- input stream of snapshot
- Throws:
- IOException
 
 - 
shouldForceWriteInitialSnapshotAfterLeaderElectionpublic boolean shouldForceWriteInitialSnapshotAfterLeaderElection() 
 - 
getDataDirSizepublic long getDataDirSize() - Specified by:
- getDataDirSizein interface- ServerStats.Provider
 
 - 
getLogDirSizepublic long getLogDirSize() - Specified by:
- getLogDirSizein interface- ServerStats.Provider
 
 - 
getZxidpublic long getZxid() 
 - 
getSessionTrackerpublic SessionTracker getSessionTracker() 
 - 
setZxidpublic void setZxid(long zxid) 
 - 
closeSessionpublic void closeSession(long sessionId) 
 - 
killSessionprotected void killSession(long sessionId, long zxid)
 - 
expirepublic void expire(SessionTracker.Session session) - Specified by:
- expirein interface- SessionTracker.SessionExpirer
 
 - 
expirepublic void expire(long sessionId) 
 - 
registerJMXprotected void registerJMX() 
 - 
startdatapublic void startdata() throws IOException, InterruptedException- Throws:
- IOException
- InterruptedException
 
 - 
startuppublic void startup() 
 - 
startupWithoutServingpublic void startupWithoutServing() 
 - 
startServingpublic void startServing() 
 - 
startJvmPauseMonitorprotected void startJvmPauseMonitor() 
 - 
startRequestThrottlerprotected void startRequestThrottler() 
 - 
createRequestThrottlerprotected RequestThrottler createRequestThrottler() 
 - 
setupRequestProcessorsprotected void setupRequestProcessors() 
 - 
getZooKeeperServerListenerpublic ZooKeeperServerListener getZooKeeperServerListener() 
 - 
setCreateSessionTrackerServerIdpublic void setCreateSessionTrackerServerId(int newId) Change the server ID used bycreateSessionTracker(). Must be called prior tostartup()being called- Parameters:
- newId- ID to use
 
 - 
createSessionTrackerprotected void createSessionTracker() 
 - 
startSessionTrackerprotected void startSessionTracker() 
 - 
setStateprotected void setState(ZooKeeperServer.State state) Sets 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.
 
- During maintenance (e.g. restore) the server sets the state to MAINTENANCE
- Parameters:
- state- new server state.
 
 - 
canShutdownprotected boolean canShutdown() This can be used while shutting down the server to see whether the server is already shutdown or not.- Returns:
- true if the server is running or server hits an error, false otherwise.
 
 - 
isRunningpublic boolean isRunning() - Returns:
- true if the server is running, false otherwise.
 
 - 
shutdownpublic void shutdown() 
 - 
shutdownpublic void shutdown(boolean fullyShutDown) Shut down the server instance- Parameters:
- fullyShutDown- true if another server using the same database will not replace this one in the same process
 
 - 
unregisterJMXprotected void unregisterJMX() 
 - 
incInProcesspublic void incInProcess() 
 - 
decInProcesspublic void decInProcess() 
 - 
getInProcesspublic int getInProcess() 
 - 
getInflightpublic int getInflight() 
 - 
checkPasswdprotected boolean checkPasswd(long sessionId, byte[] passwd)
 - 
setOwnerpublic void setOwner(long id, Object owner) throws KeeperException.SessionExpiredExceptionset the owner of this session as owner- Parameters:
- id- the session id
- owner- the owner of the session
- Throws:
- KeeperException.SessionExpiredException
 
 - 
revalidateSessionprotected void revalidateSession(ServerCnxn cnxn, long sessionId, int sessionTimeout) throws IOException - Throws:
- IOException
 
 - 
reopenSessionpublic void reopenSession(ServerCnxn cnxn, long sessionId, byte[] passwd, int sessionTimeout) throws IOException - Throws:
- IOException
 
 - 
finishSessionInitpublic void finishSessionInit(ServerCnxn cnxn, boolean valid) 
 - 
closeSessionpublic void closeSession(ServerCnxn cnxn, RequestHeader requestHeader) 
 - 
getServerIdpublic long getServerId() - Specified by:
- getServerIdin interface- SessionTracker.SessionExpirer
 
 - 
setLocalSessionFlagprotected void setLocalSessionFlag(Request si) If the underlying Zookeeper server support local session, this method will set a isLocalSession to true if a request is associated with a local session.- Parameters:
- si-
 
 - 
submitRequestpublic void submitRequest(Request si) 
 - 
enqueueRequestpublic void enqueueRequest(Request si) 
 - 
submitRequestNowpublic void submitRequestNow(Request si) 
 - 
getSnapCountpublic static int getSnapCount() 
 - 
getGlobalOutstandingLimitpublic int getGlobalOutstandingLimit() 
 - 
getSnapSizeInBytespublic static long getSnapSizeInBytes() 
 - 
setServerCnxnFactorypublic void setServerCnxnFactory(ServerCnxnFactory factory) 
 - 
getServerCnxnFactorypublic ServerCnxnFactory getServerCnxnFactory() 
 - 
getSecureServerCnxnFactorypublic ServerCnxnFactory getSecureServerCnxnFactory() 
 - 
setSecureServerCnxnFactorypublic void setSecureServerCnxnFactory(ServerCnxnFactory factory) 
 - 
getLastProcessedZxidpublic long getLastProcessedZxid() return the last processed id from the datatree- Specified by:
- getLastProcessedZxidin interface- ServerStats.Provider
 
 - 
getOutstandingRequestspublic long getOutstandingRequests() return the outstanding requests in the queue, which haven't been processed yet- Specified by:
- getOutstandingRequestsin interface- ServerStats.Provider
 
 - 
getNumAliveConnectionspublic int getNumAliveConnections() return the total number of client connections that are alive to this server- Specified by:
- getNumAliveConnectionsin interface- ServerStats.Provider
 
 - 
truncateLogpublic void truncateLog(long zxid) throws IOExceptiontruncate the log to get in sync with others if in a quorum- Parameters:
- zxid- the zxid that it needs to get in sync with others
- Throws:
- IOException
 
 - 
getTickTimepublic int getTickTime() 
 - 
setTickTimepublic void setTickTime(int tickTime) 
 - 
getThrottledOpWaitTimepublic static int getThrottledOpWaitTime() 
 - 
setThrottledOpWaitTimepublic static void setThrottledOpWaitTime(int time) 
 - 
getMinSessionTimeoutpublic int getMinSessionTimeout() 
 - 
setMinSessionTimeoutpublic void setMinSessionTimeout(int min) 
 - 
getMaxSessionTimeoutpublic int getMaxSessionTimeout() 
 - 
setMaxSessionTimeoutpublic void setMaxSessionTimeout(int max) 
 - 
getClientPortListenBacklogpublic int getClientPortListenBacklog() 
 - 
setClientPortListenBacklogpublic void setClientPortListenBacklog(int backlog) 
 - 
getClientPortpublic int getClientPort() 
 - 
getSecureClientPortpublic int getSecureClientPort() 
 - 
getMaxClientCnxnsPerHostpublic int getMaxClientCnxnsPerHost() Maximum number of connections allowed from particular host (ip)
 - 
setTxnLogFactorypublic void setTxnLogFactory(FileTxnSnapLog txnLog) 
 - 
getTxnLogFactorypublic FileTxnSnapLog getTxnLogFactory() 
 - 
getTxnLogElapsedSyncTimepublic long getTxnLogElapsedSyncTime() Returns the elapsed sync of time of transaction log in milliseconds.
 - 
getStatepublic String getState() - Specified by:
- getStatein interface- ServerStats.Provider
 
 - 
dumpEphemeralspublic void dumpEphemerals(PrintWriter pwriter) 
 - 
getConnectionDropChancepublic double getConnectionDropChance() 
 - 
processConnectRequestpublic void processConnectRequest(ServerCnxn cnxn, ConnectRequest request) throws IOException, ClientCnxnLimitException - Throws:
- IOException
- ClientCnxnLimitException
 
 - 
validateSessionprotected void validateSession(ServerCnxn cnxn, long sessionId) throws IOException Validate if a particular session can be reestablished.- Parameters:
- cnxn-
- sessionId-
- Throws:
- IOException
 
 - 
shouldThrottlepublic boolean shouldThrottle(long outStandingCount) 
 - 
getLargeRequestMaxBytespublic int getLargeRequestMaxBytes() 
 - 
setLargeRequestMaxBytespublic void setLargeRequestMaxBytes(int bytes) 
 - 
getLargeRequestThresholdpublic int getLargeRequestThreshold() 
 - 
setLargeRequestThresholdpublic void setLargeRequestThreshold(int threshold) 
 - 
getLargeRequestBytespublic int getLargeRequestBytes() 
 - 
checkRequestSizeWhenReceivingMessagepublic boolean checkRequestSizeWhenReceivingMessage(int length) throws IOException- Throws:
- IOException
 
 - 
requestFinishedpublic void requestFinished(Request request) 
 - 
processPacketpublic void processPacket(ServerCnxn cnxn, RequestHeader h, RequestRecord request) throws IOException - Throws:
- IOException
 
 - 
processTxnpublic DataTree.ProcessTxnResult processTxn(TxnHeader hdr, Record txn) 
 - 
processTxnpublic DataTree.ProcessTxnResult processTxn(Request request) 
 - 
isResponseCachingEnabledpublic boolean isResponseCachingEnabled() 
 - 
setResponseCachingEnabledpublic void setResponseCachingEnabled(boolean isEnabled) 
 - 
getReadResponseCachepublic ResponseCache getReadResponseCache() 
 - 
getGetChildrenResponseCachepublic ResponseCache getGetChildrenResponseCache() 
 - 
registerMetricsprotected void registerMetrics() 
 - 
unregisterMetricsprotected void unregisterMetrics() 
 - 
dumpMonitorValuespublic void dumpMonitorValues(BiConsumer<String,Object> response) Hook into admin server, useful to expose additional data that do not represent metrics.- Parameters:
- response- a sink which collects the data.
 
 - 
checkACLpublic void checkACL(ServerCnxn cnxn, List<ACL> acl, int perm, List<Id> ids, String path, List<ACL> setAcls) throws KeeperException.NoAuthException Grant or deny authorization to an operation on a node as a function of:- Parameters:
- cnxn- : the server connection or null for admin server commands
- acl- : set of ACLs for the node
- perm- : the permission that the client is requesting
- ids- : the credentials supplied by the client
- path- : the ZNode path
- setAcls- : for set ACL operations, the list of ACLs being set. Otherwise null.
- Throws:
- KeeperException.NoAuthException
 
 - 
checkQuotapublic void checkQuota(String path, byte[] lastData, byte[] data, int type) throws KeeperException.QuotaExceededException check a path whether exceeded the quota.- Parameters:
- path- the path of the node, used for the quota prefix check
- lastData- the current node data,- nullfor none
- data- the data to be set, or- nullfor none
- type- currently, create and setData need to check quota
- Throws:
- KeeperException.QuotaExceededException
 
 - 
isDigestEnabledpublic static boolean isDigestEnabled() 
 - 
setDigestEnabledpublic static void setDigestEnabled(boolean digestEnabled) 
 - 
isSerializeLastProcessedZxidEnabledpublic static boolean isSerializeLastProcessedZxidEnabled() 
 - 
setSerializeLastProcessedZxidEnabledpublic static void setSerializeLastProcessedZxidEnabled(boolean serializeLastZxidEnabled) 
 - 
authWriteRequestpublic boolean authWriteRequest(Request request) Check Write Requests for Potential Access Restrictions Before a request is being proposed to the quorum, lets check it against local ACLs. Non-write requests (read, session, etc.) are passed along. Invalid requests are sent a response. While we are at it, if the request will set an ACL: make sure it's a valid one.- Parameters:
- request-
- Returns:
- true if request is permitted, false if not.
- Throws:
- IOException
 
 - 
getOutstandingHandshakeNumpublic int getOutstandingHandshakeNum() 
 - 
isReconfigEnabledpublic boolean isReconfigEnabled() 
 - 
getZkShutdownHandlerpublic ZooKeeperServerShutdownHandler getZkShutdownHandler() 
 
- 
 
-