Class TNonblockingServer

Direct Known Subclasses:
THsHaServer

public class TNonblockingServer extends AbstractNonblockingServer
A nonblocking TServer implementation. This allows for fairness amongst all connected clients in terms of invocations.

This server is inherently single-threaded. If you want a limited thread pool coupled with invocation-fairness, see THsHaServer.

To use this server, you MUST use a TFramedTransport at the outermost transport, otherwise this server will be unable to determine when a whole method call has been read off the wire. Clients must also use TFramedTransport.

  • Constructor Details

  • Method Details

    • startThreads

      protected boolean startThreads()
      Start the selector thread to deal with accepts and client messages.
      Specified by:
      startThreads in class AbstractNonblockingServer
      Returns:
      true if everything went ok, false if we couldn't start for some reason.
    • waitForShutdown

      protected void waitForShutdown()
      Description copied from class: AbstractNonblockingServer
      A method that will block until when threads handling the serving have been shut down.
      Specified by:
      waitForShutdown in class AbstractNonblockingServer
    • joinSelector

      protected void joinSelector()
      Block until the selector thread exits.
    • stop

      public void stop()
      Stop serving and shut everything down.
      Overrides:
      stop in class TServer
    • requestInvoke

      protected boolean requestInvoke(AbstractNonblockingServer.FrameBuffer frameBuffer)
      Perform an invocation. This method could behave several different ways - invoke immediately inline, queue for separate execution, etc.
      Specified by:
      requestInvoke in class AbstractNonblockingServer
      Returns:
      true if invocation was successfully requested, which is not a guarantee that invocation has completed. False if the request failed.
    • isStopped

      public boolean isStopped()