Class ControllableConnectionFactory
- java.lang.Object
- 
- org.apache.zookeeper.server.ServerCnxnFactory
- 
- org.apache.zookeeper.server.NIOServerCnxnFactory
- 
- org.apache.zookeeper.server.controller.ControllableConnectionFactory
 
 
 
- 
 public class ControllableConnectionFactory extends NIOServerCnxnFactory Extension of NIOServerCnxnFactory which can inject changes per controller commands. Similar extensions can implement on top of NettyServerCnxnFactory as well.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.zookeeper.server.NIOServerCnxnFactoryNIOServerCnxnFactory.SelectorThread
 
- 
 - 
Field Summary- 
Fields inherited from class org.apache.zookeeper.server.NIOServerCnxnFactorymaxClientCnxns, workerPool, ZOOKEEPER_NIO_DIRECT_BUFFER_BYTES, ZOOKEEPER_NIO_NUM_SELECTOR_THREADS, ZOOKEEPER_NIO_NUM_WORKER_THREADS, ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT
 - 
Fields inherited from class org.apache.zookeeper.server.ServerCnxnFactorycnxns, login, maxCnxns, saslServerCallbackHandler, secure, zkServer, ZOOKEEPER_MAX_CONNECTION_DEFAULT, ZOOKEEPER_SERVER_CNXN_FACTORY
 
- 
 - 
Constructor SummaryConstructors Constructor Description ControllableConnectionFactory()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NIOServerCnxncreateConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread)voiddelayRequestIfNeeded()Called by the connection to delay processing requests from the client.voiddelayResponses(long delayInMs)voidfailAllFutureRequests()voidfailFutureRequests(long requestsToFail)voidholdAllFutureResponses()voidholdFutureResponses(long requestsToHold)voidresetBadBehavior()booleanshouldFailNextRequest()Check if we should fail the next incoming request.booleanshouldSendResponse()Check if we should send a response to the latest processed request (true), or eat the response to mess with the client (false).- 
Methods inherited from class org.apache.zookeeper.server.NIOServerCnxnFactorycloseAll, configure, dumpConnections, getAllConnectionInfo, getConnections, getDirectBuffer, getLocalAddress, getLocalPort, getMaxClientCnxnsPerHost, getSocketListenBacklog, join, reconfigure, removeCnxn, resetAllConnectionStats, setMaxClientCnxnsPerHost, shutdown, start, startup, stop, touchCnxn
 - 
Methods inherited from class org.apache.zookeeper.server.ServerCnxnFactoryaddSession, closeSession, configure, configure, configureSaslLogin, createFactory, createFactory, createFactory, createFactory, createFactory, getMaxCnxns, getNumAliveConnections, getUserName, getZooKeeperServer, initMaxCnxns, isSecure, limitTotalNumberOfCnxns, registerConnection, removeCnxnFromSessionMap, setZooKeeperServer, startup, unregisterConnection
 
- 
 
- 
- 
- 
Method Detail- 
createConnectionprotected NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException - Overrides:
- createConnectionin class- NIOServerCnxnFactory
- Throws:
- IOException
 
 - 
delayRequestIfNeededpublic void delayRequestIfNeeded() Called by the connection to delay processing requests from the client.
 - 
shouldFailNextRequestpublic boolean shouldFailNextRequest() Check if we should fail the next incoming request. If so, decrement the remaining requests to fail.
 - 
shouldSendResponsepublic boolean shouldSendResponse() Check if we should send a response to the latest processed request (true), or eat the response to mess with the client (false). If so, decrement the remaining requests to eat.
 - 
delayResponsespublic void delayResponses(long delayInMs) 
 - 
resetBadBehaviorpublic void resetBadBehavior() 
 - 
failAllFutureRequestspublic void failAllFutureRequests() 
 - 
failFutureRequestspublic void failFutureRequests(long requestsToFail) 
 - 
holdAllFutureResponsespublic void holdAllFutureResponses() 
 - 
holdFutureResponsespublic void holdFutureResponses(long requestsToHold) 
 
- 
 
-