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.
    • Method Detail

      • 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.
      • 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()