Package com.mongodb.selector
Class LatencyMinimizingServerSelector
- java.lang.Object
-
- com.mongodb.selector.LatencyMinimizingServerSelector
-
- All Implemented Interfaces:
ServerSelector
public class LatencyMinimizingServerSelector extends java.lang.Object implements ServerSelector
A server selector that accepts only servers within the given ping-time latency difference from the faster of the servers.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description LatencyMinimizingServerSelector(long acceptableLatencyDifference, java.util.concurrent.TimeUnit timeUnit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)longgetAcceptableLatencyDifference(java.util.concurrent.TimeUnit timeUnit)Gets the acceptable latency difference.inthashCode()java.util.List<ServerDescription>select(ClusterDescription clusterDescription)Select a list of server descriptions from the given cluster description according to some criteria.java.lang.StringtoString()
-
-
-
Constructor Detail
-
LatencyMinimizingServerSelector
public LatencyMinimizingServerSelector(long acceptableLatencyDifference, java.util.concurrent.TimeUnit timeUnit)- Parameters:
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 acceptableLatencyDifference
-
-
Method Detail
-
getAcceptableLatencyDifference
public long getAcceptableLatencyDifference(java.util.concurrent.TimeUnit timeUnit)
Gets the acceptable latency difference.- Parameters:
timeUnit- the time unit to get it in.- Returns:
- the acceptable latency difference in the specified time unit
-
select
public java.util.List<ServerDescription> select(ClusterDescription clusterDescription)
Description copied from interface:ServerSelectorSelect a list of server descriptions from the given cluster description according to some criteria.- Specified by:
selectin interfaceServerSelector- Parameters:
clusterDescription- the cluster of servers to select from- Returns:
- a non-null list of ServerDescriptions that meet the requirements of this ServerSelector. This may be empty.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-