public interface NetworkClient
extends java.io.Closeable
NetworkClient
provides a method for sending a list of requests to one or more destinations,
and receiving responses for sent requests.Modifier and Type | Method and Description |
---|---|
void |
close() |
java.util.List<ResponseInfo> |
sendAndPoll(java.util.List<RequestInfo> requestsToSend,
java.util.Set<java.lang.Integer> requestsToDrop,
int pollTimeoutMs)
Attempt to send the given requests and poll for responses from the network.
|
void |
wakeup()
Wake up the NetworkClient if it is within a
sendAndPoll(List, Set, int) sleep. |
int |
warmUpConnections(java.util.List<DataNodeId> dataNodeIds,
int connectionWarmUpPercentagePerDataNode,
long timeForWarmUp,
java.util.List<ResponseInfo> responseInfoList)
Warm up connections to dataNodes in a specified time window.
|
java.util.List<ResponseInfo> sendAndPoll(java.util.List<RequestInfo> requestsToSend, java.util.Set<java.lang.Integer> requestsToDrop, int pollTimeoutMs)
requestsToSend
- the list of RequestInfo
representing the requests that need to be sent out. This
could be empty.requestsToDrop
- the list of correlation IDs representing the requests that can be dropped by
closing the connection.pollTimeoutMs
- the poll timeout.ResponseInfo
representing the responses received for any requests that were sent out
so far.java.lang.IllegalStateException
- if the NetworkClient is closed.int warmUpConnections(java.util.List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, java.util.List<ResponseInfo> responseInfoList)
dataNodeIds
- warm up target nodes.connectionWarmUpPercentagePerDataNode
- percentage of max connections would like to establish in the warmup.timeForWarmUp
- max time to wait for connections' establish in milliseconds.responseInfoList
- records responses from disconnected connections.void wakeup()
sendAndPoll(List, Set, int)
sleep.void close()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable