Class AbstractServerBase<REQ extends MessageBody,​RESP extends MessageBody>

  • Type Parameters:
    REQ - the type of request the server expects to receive.
    RESP - the type of response the server will send.
    Direct Known Subclasses:
    KvStateClientProxyImpl, KvStateServerImpl

    @Internal
    public abstract class AbstractServerBase<REQ extends MessageBody,​RESP extends MessageBody>
    extends Object
    The base class for every server in the queryable state module. It is using pure netty to send and receive messages of type MessageBody.
    • Field Detail

      • log

        protected final org.slf4j.Logger log
    • Constructor Detail

      • AbstractServerBase

        protected AbstractServerBase​(String serverName,
                                     String bindAddress,
                                     Iterator<Integer> bindPortIterator,
                                     Integer numEventLoopThreads,
                                     Integer numQueryThreads)
        Creates the AbstractServerBase.

        The server needs to be started via start().

        Parameters:
        serverName - the name of the server
        bindAddress - address to bind to
        bindPortIterator - port to bind to
        numEventLoopThreads - number of event loop threads
    • Method Detail

      • getQueryExecutor

        protected ExecutorService getQueryExecutor()
        Returns the thread-pool responsible for processing incoming requests.
      • getServerName

        public String getServerName()
        Gets the name of the server. This is useful for debugging.
        Returns:
        The name of the server.
      • getServerAddress

        public InetSocketAddress getServerAddress()
        Returns the address of this server.
        Returns:
        AbstractServerBase address
        Throws:
        IllegalStateException - If server has not been started yet
      • start

        public void start()
                   throws Throwable
        Starts the server by binding to the configured bind address (blocking).
        Throws:
        Exception - If something goes wrong during the bind operation.
        Throwable
      • shutdownServer

        public CompletableFuture<Void> shutdownServer()
        Shuts down the server and all related thread pools.
        Returns:
        A CompletableFuture that will be completed upon termination of the shutdown process.