public class LatencyMinimizingServerSelector extends Object implements ServerSelector
Constructor and Description |
---|
LatencyMinimizingServerSelector(long acceptableLatencyDifference,
TimeUnit timeUnit) |
Modifier and Type | Method and Description |
---|---|
long |
getAcceptableLatencyDifference(TimeUnit timeUnit)
Gets the acceptable latency difference.
|
List<ServerDescription> |
select(ClusterDescription clusterDescription)
Select a list of server descriptions from the given cluster description according to some criteria.
|
String |
toString() |
public LatencyMinimizingServerSelector(long acceptableLatencyDifference, TimeUnit timeUnit)
acceptableLatencyDifference
- the maximum difference in ping-time latency between the fastest ping time and the slowest of
the chosen serverstimeUnit
- the time unit of the acceptableLatencyDifferencepublic long getAcceptableLatencyDifference(TimeUnit timeUnit)
timeUnit
- the time unit to get it in.public List<ServerDescription> select(ClusterDescription clusterDescription)
ServerSelector
select
in interface ServerSelector
clusterDescription
- the cluster of servers to select from