public CircuitBreaker(CircuitPolicy policy = null, ICircuitInvoker invoker = null, Action <CircuitBreaker, Exception> onFailure = null, Action <CircuitBreaker, CircuitStatus> onStateChange = null) { _onFailure = onFailure; _onStateChange = onStateChange; _policy = policy ?? CircuitPolicy.DefaultPolicy; invoker = invoker ?? DefaultInvoker; _closedState = new ClosedState(this, _policy, invoker); _halfOpenState = new HalfOpenState(this, _policy, invoker); _openState = new OpenState(this, _policy, invoker); _currentState = _closedState; }
public CircuitState(CircuitBreaker circuitBreaker, CircuitPolicy policy, ICircuitInvoker invoker) { _policy = policy; _invoker = invoker; _circuitBreaker = circuitBreaker; }
public OpenState(CircuitBreaker circuitBreaker, CircuitPolicy policy, ICircuitInvoker invoker) : base(circuitBreaker, policy, invoker) { }