Class 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.
  • Constructor Details

    • ControllableConnectionFactory

      public ControllableConnectionFactory()
  • Method Details

    • createConnection

      protected NIOServerCnxn createConnection(SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException
      Overrides:
      createConnection in class NIOServerCnxnFactory
      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)