All Downloads are FREE. Search and download functionalities are using the official Maven repository.

netflix.ocelli.LoadBalancerBuilder Maven / Gradle / Ivy

There is a newer version: 0.1.0-rc.2
Show newest version
package netflix.ocelli;

import netflix.ocelli.selectors.ClientsAndWeights;
import rx.Observable;
import rx.functions.Func1;

public interface LoadBalancerBuilder {
    /**
     * Arbitrary name used in debugging
     * @param name
     */
    LoadBalancerBuilder withName(String name);
    
    /**
     * Strategy used to determine the delay time in msec based on the quarantine 
     * count.  The count is incremented by one for each failure detections and reset
     * once the host is back to normal.
     */
    LoadBalancerBuilder withQuarantineStrategy(Func1 quaratineDelayStrategy);
    
    /**
     * Strategy used to determine how many hosts should be active.
     * This strategy is invoked whenever a host is added or removed from the pool
     */
    LoadBalancerBuilder withActiveClientCountStrategy(Func1 activeClientCountStrategy);
    
    /**
     * Source for host membership events
     */
    LoadBalancerBuilder withMembershipSource(Observable> hostSource);
    
    /**
     * Strategy use to calculate weights for active clients
     */
    LoadBalancerBuilder withWeightingStrategy(WeightingStrategy algorithm);
    
    /**
     * Strategy used to select hosts from the calculated weights.  
     * @param selectionStrategy
     */
    LoadBalancerBuilder withSelectionStrategy(Func1, Observable> selectionStrategy);
    
    /**
     * The failure detector returns an Observable that will emit a Throwable for each 
     * failure of the client.  The load balancer will quaratine the client in response.
     * @param failureDetector
     */
    LoadBalancerBuilder withFailureDetector(FailureDetectorFactory failureDetector);
    
    /**
     * The connector can be used to prime a client prior to activating it in the connection
     * pool.  
     * @param clientConnector
     */
    LoadBalancerBuilder withClientConnector(ClientConnector clientConnector);
    
    /**
     * Partition the load balancer using the provided function
     * 
     * @param partitioner
     * @return
     */
     PartitionedLoadBalancerBuilder withPartitioner(Func1> partitioner);
    
    LoadBalancer build();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy