public abstract class AbstractServerPredicate extends java.lang.Object implements com.google.common.base.Predicate<PredicateKey>
PredicateKey, which has Server and load balancer key
information. Therefore, it is possible to develop logic to filter servers by both Server and load balancer
key or either one of them.| Constructor and Description |
|---|
AbstractServerPredicate() |
AbstractServerPredicate(IRule rule) |
AbstractServerPredicate(IRule rule,
com.netflix.client.config.IClientConfig clientConfig)
Deprecated.
|
AbstractServerPredicate(LoadBalancerStats lbStats) |
AbstractServerPredicate(LoadBalancerStats lbStats,
com.netflix.client.config.IClientConfig clientConfig)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static AbstractServerPredicate |
alwaysTrue() |
com.google.common.base.Optional<Server> |
chooseRandomlyAfterFiltering(java.util.List<Server> servers)
Choose a random server after the predicate filters a list of servers.
|
com.google.common.base.Optional<Server> |
chooseRandomlyAfterFiltering(java.util.List<Server> servers,
java.lang.Object loadBalancerKey)
Choose a random server after the predicate filters list of servers given list of servers and
load balancer key.
|
com.google.common.base.Optional<Server> |
chooseRoundRobinAfterFiltering(java.util.List<Server> servers)
Choose a server in a round robin fashion after the predicate filters a list of servers.
|
com.google.common.base.Optional<Server> |
chooseRoundRobinAfterFiltering(java.util.List<Server> servers,
java.lang.Object loadBalancerKey)
Choose a server in a round robin fashion after the predicate filters a given list of servers and load balancer key.
|
java.util.List<Server> |
getEligibleServers(java.util.List<Server> servers)
Get servers filtered by this predicate from list of servers.
|
java.util.List<Server> |
getEligibleServers(java.util.List<Server> servers,
java.lang.Object loadBalancerKey)
Get servers filtered by this predicate from list of servers.
|
protected LoadBalancerStats |
getLBStats() |
com.google.common.base.Predicate<Server> |
getServerOnlyPredicate()
Get the predicate to filter list of servers.
|
static AbstractServerPredicate |
ofKeyPredicate(com.google.common.base.Predicate<PredicateKey> p)
Create an instance from a predicate.
|
static AbstractServerPredicate |
ofServerPredicate(com.google.common.base.Predicate<Server> p)
Create an instance from a predicate.
|
void |
setLoadBalancerStats(LoadBalancerStats stats) |
protected IRule rule
public AbstractServerPredicate()
public AbstractServerPredicate(IRule rule)
@Deprecated public AbstractServerPredicate(IRule rule, com.netflix.client.config.IClientConfig clientConfig)
@Deprecated public AbstractServerPredicate(LoadBalancerStats lbStats, com.netflix.client.config.IClientConfig clientConfig)
public AbstractServerPredicate(LoadBalancerStats lbStats)
public static AbstractServerPredicate alwaysTrue()
protected LoadBalancerStats getLBStats()
public void setLoadBalancerStats(LoadBalancerStats stats)
public com.google.common.base.Predicate<Server> getServerOnlyPredicate()
public java.util.List<Server> getEligibleServers(java.util.List<Server> servers)
getEligibleServers(List, Object)public java.util.List<Server> getEligibleServers(java.util.List<Server> servers, java.lang.Object loadBalancerKey)
public com.google.common.base.Optional<Server> chooseRandomlyAfterFiltering(java.util.List<Server> servers)
public com.google.common.base.Optional<Server> chooseRoundRobinAfterFiltering(java.util.List<Server> servers)
public com.google.common.base.Optional<Server> chooseRandomlyAfterFiltering(java.util.List<Server> servers, java.lang.Object loadBalancerKey)
public com.google.common.base.Optional<Server> chooseRoundRobinAfterFiltering(java.util.List<Server> servers, java.lang.Object loadBalancerKey)
public static AbstractServerPredicate ofKeyPredicate(com.google.common.base.Predicate<PredicateKey> p)
public static AbstractServerPredicate ofServerPredicate(com.google.common.base.Predicate<Server> p)