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 typeMessageBody.
-
-
Constructor Summary
Constructors Constructor Description Client(String clientName, int numEventLoopThreads, MessageSerializer<REQ,RESP> serializer, KvStateRequestStats stats)Creates a client with the specified number of event loop threads.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClientName()booleanisEventGroupShutdown()CompletableFuture<RESP>sendRequest(InetSocketAddress serverAddress, REQ request)CompletableFuture<Void>shutdown()Shuts down the client and closes all connections.
-
-
-
Constructor Detail
-
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 Detail
-
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
CompletableFuturethat will be completed when the shutdown process is done.
-
isEventGroupShutdown
@VisibleForTesting public boolean isEventGroupShutdown()
-
-