Class GracePeriodCircuitBreaker

java.lang.Object
ai.vespa.feed.client.impl.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
  • Nested Class Summary

    Nested classes/interfaces inherited from interface ai.vespa.feed.client.FeedClient.CircuitBreaker

    ai.vespa.feed.client.FeedClient.CircuitBreaker.State
  • Field Summary

    Fields inherited from interface ai.vespa.feed.client.FeedClient.CircuitBreaker

    FUSED
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new circuit breaker with the given grace periods.
    Creates a new circuit breaker with the given grace periods.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    failure(ai.vespa.feed.client.HttpResponse response)
     
    void
     
    ai.vespa.feed.client.FeedClient.CircuitBreaker.State
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • 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