Class ControllableConnectionFactory
java.lang.Object
org.apache.zookeeper.server.ServerCnxnFactory
org.apache.zookeeper.server.NIOServerCnxnFactory
org.apache.zookeeper.server.controller.ControllableConnectionFactory
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.NIOServerCnxnFactory
NIOServerCnxnFactory.SelectorThread -
Field Summary
Fields inherited from class org.apache.zookeeper.server.NIOServerCnxnFactory
maxClientCnxns, workerPool, ZOOKEEPER_NIO_DIRECT_BUFFER_BYTES, ZOOKEEPER_NIO_NUM_SELECTOR_THREADS, ZOOKEEPER_NIO_NUM_WORKER_THREADS, ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, ZOOKEEPER_NIO_SHUTDOWN_TIMEOUTFields inherited from class org.apache.zookeeper.server.ServerCnxnFactory
cnxns, login, maxCnxns, saslServerCallbackHandler, secure, zkServer, ZOOKEEPER_MAX_CONNECTION_DEFAULT, ZOOKEEPER_SERVER_CNXN_FACTORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NIOServerCnxncreateConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread) voidCalled by the connection to delay processing requests from the client.voiddelayResponses(long delayInMs) voidvoidfailFutureRequests(long requestsToFail) voidvoidholdFutureResponses(long requestsToHold) voidbooleanCheck if we should fail the next incoming request.booleanCheck 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.NIOServerCnxnFactory
closeAll, configure, dumpConnections, getAllConnectionInfo, getConnections, getDirectBuffer, getLocalAddress, getLocalPort, getMaxClientCnxnsPerHost, getSocketListenBacklog, join, reconfigure, removeCnxn, resetAllConnectionStats, setMaxClientCnxnsPerHost, shutdown, start, startup, stop, touchCnxnMethods inherited from class org.apache.zookeeper.server.ServerCnxnFactory
addSession, closeSession, configure, configure, configureSaslLogin, createFactory, createFactory, createFactory, createFactory, createFactory, getMaxCnxns, getNumAliveConnections, getUserName, getZooKeeperServer, initMaxCnxns, isSecure, limitTotalNumberOfCnxns, registerConnection, removeCnxnFromSessionMap, setZooKeeperServer, startup, unregisterConnection
-
Constructor Details
-
ControllableConnectionFactory
public ControllableConnectionFactory()
-
-
Method Details
-
createConnection
protected NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException - Overrides:
createConnectionin classNIOServerCnxnFactory- Throws:
IOException
-
delayRequestIfNeeded
public void delayRequestIfNeeded()Called by the connection to delay processing requests from the client. -
shouldFailNextRequest
public boolean shouldFailNextRequest()Check if we should fail the next incoming request. If so, decrement the remaining requests to fail. -
shouldSendResponse
public 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. -
delayResponses
public void delayResponses(long delayInMs) -
resetBadBehavior
public void resetBadBehavior() -
failAllFutureRequests
public void failAllFutureRequests() -
failFutureRequests
public void failFutureRequests(long requestsToFail) -
holdAllFutureResponses
public void holdAllFutureResponses() -
holdFutureResponses
public void holdFutureResponses(long requestsToHold)
-