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.
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 Summary
ConstructorsConstructorDescriptionClient(String clientName, int numEventLoopThreads, MessageSerializer<REQ, RESP> serializer, KvStateRequestStats stats) Creates a client with the specified number of event loop threads. -
Method Summary
Modifier and TypeMethodDescriptionbooleansendRequest(InetSocketAddress serverAddress, REQ request) shutdown()Shuts down the client and closes all connections.
-
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
-
sendRequest
-
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()
-