Class Client<REQ extends MessageBody,RESP extends MessageBody>

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

@Internal public class Client<REQ extends MessageBody,RESP extends MessageBody> extends Object
The base class for every client in the queryable state module. It is using pure netty to send and receive messages of type MessageBody.
  • Constructor Details

    • Client

      public Client(String clientName, int numEventLoopThreads, MessageSerializer<REQ,RESP> serializer, KvStateRequestStats stats)
      Creates a client with the specified number of event loop threads.
      Parameters:
      clientName - the name of the client.
      numEventLoopThreads - number of event loop threads (minimum 1).
      serializer - the serializer used to (de-)serialize messages.
      stats - the statistics collector.
  • Method Details

    • getClientName

      public String getClientName()
    • sendRequest

      public CompletableFuture<RESP> sendRequest(InetSocketAddress serverAddress, REQ request)
    • shutdown

      public CompletableFuture<Void> shutdown()
      Shuts down the client and closes all connections.

      After a call to this method, all returned futures will be failed.

      Returns:
      A CompletableFuture that will be completed when the shutdown process is done.
    • isEventGroupShutdown

      @VisibleForTesting public boolean isEventGroupShutdown()