Class AbstractServerBase<REQ extends MessageBody,RESP extends MessageBody>

java.lang.Object
org.apache.flink.queryablestate.network.AbstractServerBase<REQ,RESP>
Type Parameters:
REQ - the type of request the server expects to receive.
RESP - the type of response the server will send.

@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 Details

    • log

      protected final org.slf4j.Logger log
  • Constructor Details

    • 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 Details

    • 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.
    • initializeHandler

      public abstract AbstractServerHandler<REQ,RESP> initializeHandler()
      Returns the handler to be used for serving the incoming requests.
    • 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.
    • isEventGroupShutdown

      @VisibleForTesting public boolean isEventGroupShutdown()