Class StickyLoadBalancer

  • All Implemented Interfaces:
    LoadBalancer, CallStatisticsCollector

    public class StickyLoadBalancer
    extends Object
    implements LoadBalancer, CallStatisticsCollector
    Select a single instance and use it until it fails. On failure, store the time of failure in `failedInstances` map.

    When new instance selection is needed:

    • if there's an instance for which we don't have a failure recorded, use it
    • otherwise, pick the instance whose failure was the longest time away and:
      • return it if failureBackOff has passed since its last failure
      • throw NoAcceptableServiceInstanceFoundException if it has not
    • Constructor Detail

      • StickyLoadBalancer

        public StickyLoadBalancer​(Duration failureBackOff)
        Creates a new Sticky load balancer
        Parameters:
        failureBackOff - the failure backoff