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
MessageBody
.Constructor and Description |
---|
Client(String clientName,
int numEventLoopThreads,
MessageSerializer<REQ,RESP> serializer,
KvStateRequestStats stats)
Creates a client with the specified number of event loop threads.
|
Modifier and Type | Method and Description |
---|---|
String |
getClientName() |
boolean |
isEventGroupShutdown() |
CompletableFuture<RESP> |
sendRequest(InetSocketAddress serverAddress,
REQ request) |
CompletableFuture<Void> |
shutdown()
Shuts down the client and closes all connections.
|
public Client(String clientName, int numEventLoopThreads, MessageSerializer<REQ,RESP> serializer, KvStateRequestStats stats)
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.public String getClientName()
public CompletableFuture<RESP> sendRequest(InetSocketAddress serverAddress, REQ request)
public CompletableFuture<Void> shutdown()
After a call to this method, all returned futures will be failed.
CompletableFuture
that will be completed when the shutdown process is done.@VisibleForTesting public boolean isEventGroupShutdown()
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.