Class HalfOpenState<R>

java.lang.Object
dev.failsafe.internal.CircuitState<R>
dev.failsafe.internal.HalfOpenState<R>

class HalfOpenState<R> extends CircuitState<R>
  • Field Details

    • permittedExecutions

      protected final AtomicInteger permittedExecutions
  • Constructor Details

  • Method Details

    • tryAcquirePermit

      public boolean tryAcquirePermit()
      Specified by:
      tryAcquirePermit in class CircuitState<R>
    • releasePermit

      public void releasePermit()
      Overrides:
      releasePermit in class CircuitState<R>
    • getState

      public CircuitBreaker.State getState()
      Specified by:
      getState in class CircuitState<R>
    • handleConfigChange

      public void handleConfigChange()
      Overrides:
      handleConfigChange in class CircuitState<R>
    • checkThreshold

      void checkThreshold(ExecutionContext<R> context)
      Checks to determine if a threshold has been met and the circuit should be opened or closed.

      If a success threshold is configured, the circuit is opened or closed based on whether the ratio was exceeded.

      Else the circuit is opened or closed based on whether the failure threshold was exceeded.

      Overrides:
      checkThreshold in class CircuitState<R>
    • capacityFor

      private static int capacityFor(CircuitBreaker<?> breaker)
      Returns the capacity of the breaker in the half-open state.