com.netflix.loadbalancer
Class CompositePredicate
java.lang.Object
com.netflix.loadbalancer.AbstractServerPredicate
com.netflix.loadbalancer.CompositePredicate
- All Implemented Interfaces:
- com.google.common.base.Predicate<PredicateKey>
public class CompositePredicate
- extends AbstractServerPredicate
A predicate that is composed from one or more predicates in "AND" relationship.
It also has the functionality of "fallback" to one of more different predicates.
If the primary predicate yield too few filtered servers from the getEligibleServers(List, Object)
API, it will try the fallback predicates one by one, until the number of filtered servers
exceeds certain number threshold or percentage threshold.
| Methods inherited from class com.netflix.loadbalancer.AbstractServerPredicate |
alwaysTrue, chooseRandomlyAfterFiltering, chooseRandomlyAfterFiltering, chooseRoundRobinAfterFiltering, chooseRoundRobinAfterFiltering, getEligibleServers, getLBStats, getServerOnlyPredicate, ofKeyPredicate, ofServerPredicate, setLoadBalancerStats |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.common.base.Predicate |
equals |
CompositePredicate
public CompositePredicate()
apply
public boolean apply(@Nullable
PredicateKey input)
withPredicates
public static CompositePredicate.Builder withPredicates(AbstractServerPredicate... primaryPredicates)
withPredicate
public static CompositePredicate.Builder withPredicate(AbstractServerPredicate primaryPredicate)
getEligibleServers
public java.util.List<Server> getEligibleServers(java.util.List<Server> servers,
java.lang.Object loadBalancerKey)
- Get the filtered servers from primary predicate, and if the number of the filtered servers
are not enough, trying the fallback predicates
- Overrides:
getEligibleServers in class AbstractServerPredicate