Class GracePeriodCircuitBreaker

  • All Implemented Interfaces:
    ai.vespa.feed.client.FeedClient.CircuitBreaker

    public class GracePeriodCircuitBreaker
    extends Object
    implements ai.vespa.feed.client.FeedClient.CircuitBreaker
    Breaks the circuit when no successes have been recorded for a specified time.
    Author:
    jonmv
    • Constructor Detail

      • GracePeriodCircuitBreaker

        public GracePeriodCircuitBreaker​(Duration grace)
        Creates a new circuit breaker with the given grace periods.
        Parameters:
        grace - the period of consecutive failures before state changes to half-open.
      • GracePeriodCircuitBreaker

        public GracePeriodCircuitBreaker​(Duration grace,
                                         Duration doom)
        Creates a new circuit breaker with the given grace periods.
        Parameters:
        grace - the period of consecutive failures before state changes to half-open.
        doom - the period of consecutive failures before shutting down.
    • Method Detail

      • success

        public void success()
        Specified by:
        success in interface ai.vespa.feed.client.FeedClient.CircuitBreaker
      • failure

        public void failure​(ai.vespa.feed.client.HttpResponse response)
        Specified by:
        failure in interface ai.vespa.feed.client.FeedClient.CircuitBreaker
      • failure

        public void failure​(Throwable cause)
        Specified by:
        failure in interface ai.vespa.feed.client.FeedClient.CircuitBreaker
      • state

        public ai.vespa.feed.client.FeedClient.CircuitBreaker.State state()
        Specified by:
        state in interface ai.vespa.feed.client.FeedClient.CircuitBreaker