Package ai.vespa.feed.client.impl
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
-
-
Constructor Summary
Constructors Constructor Description GracePeriodCircuitBreaker(Duration grace)
Creates a new circuit breaker with the given grace periods.GracePeriodCircuitBreaker(Duration grace, Duration doom)
Creates a new circuit breaker with the given grace periods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
failure(ai.vespa.feed.client.HttpResponse response)
void
failure(Throwable cause)
ai.vespa.feed.client.FeedClient.CircuitBreaker.State
state()
void
success()
-
-
-
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 interfaceai.vespa.feed.client.FeedClient.CircuitBreaker
-
failure
public void failure(ai.vespa.feed.client.HttpResponse response)
- Specified by:
failure
in interfaceai.vespa.feed.client.FeedClient.CircuitBreaker
-
failure
public void failure(Throwable cause)
- Specified by:
failure
in interfaceai.vespa.feed.client.FeedClient.CircuitBreaker
-
state
public ai.vespa.feed.client.FeedClient.CircuitBreaker.State state()
- Specified by:
state
in interfaceai.vespa.feed.client.FeedClient.CircuitBreaker
-
-