com.netflix.loadbalancer
Class PredicateBasedRule

java.lang.Object
  extended by com.netflix.loadbalancer.AbstractLoadBalancerRule
      extended by com.netflix.loadbalancer.ClientConfigEnabledRoundRobinRule
          extended by com.netflix.loadbalancer.PredicateBasedRule
All Implemented Interfaces:
com.netflix.client.IClientConfigAware, IRule
Direct Known Subclasses:
AvailabilityFilteringRule, ZoneAvoidanceRule

public abstract class PredicateBasedRule
extends ClientConfigEnabledRoundRobinRule

A rule which delegates the server filtering logic to an instance of AbstractServerPredicate. After filtering, a server is returned from filtered list in a round robin fashion.


Constructor Summary
PredicateBasedRule()
           
 
Method Summary
 Server choose(java.lang.Object key)
          Get a server by calling AbstractServerPredicate.chooseRandomlyAfterFiltering(java.util.List, Object).
abstract  AbstractServerPredicate getPredicate()
          Method that provides an instance of AbstractServerPredicate to be used by this class.
 
Methods inherited from class com.netflix.loadbalancer.ClientConfigEnabledRoundRobinRule
initWithNiwsConfig, setLoadBalancer
 
Methods inherited from class com.netflix.loadbalancer.AbstractLoadBalancerRule
getLoadBalancer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicateBasedRule

public PredicateBasedRule()
Method Detail

getPredicate

public abstract AbstractServerPredicate getPredicate()
Method that provides an instance of AbstractServerPredicate to be used by this class.


choose

public Server choose(java.lang.Object key)
Get a server by calling AbstractServerPredicate.chooseRandomlyAfterFiltering(java.util.List, Object). The performance for this method is O(n) where n is number of servers to be filtered.

Specified by:
choose in interface IRule
Overrides:
choose in class ClientConfigEnabledRoundRobinRule