Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix
Interface HystrixCircuitBreaker


public interface HystrixCircuitBreaker

Circuit-breaker logic that is hooked into HystrixCommand execution and will stop allowing executions if failures have gone past the defined threshold.

It will then allow single retries after a defined sleepWindow until the execution succeeds at which point it will again close the circuit and allow executions again.


Method Summary
 boolean allowRequest()
          Every HystrixCommand requests asks this if it is allowed to proceed or not.
 boolean isOpen()
          Whether the circuit is currently open (tripped).
 void markSuccess()
          Invoked on successful executions from HystrixCommand as part of feedback mechanism when in a half-open state.
 

Method Detail

allowRequest

boolean allowRequest()
Every HystrixCommand requests asks this if it is allowed to proceed or not.

This takes into account the half-open logic which allows some requests through when determining if it should be closed again.

Returns:
boolean whether a request should be permitted

isOpen

boolean isOpen()
Whether the circuit is currently open (tripped).

Returns:
boolean state of circuit breaker

markSuccess

void markSuccess()
Invoked on successful executions from HystrixCommand as part of feedback mechanism when in a half-open state.