Class EventCountCircuitBreaker.StateStrategy

    • Constructor Detail

      • StateStrategy

        private StateStrategy()
    • Method Detail

      • isCheckIntervalFinished

        public boolean isCheckIntervalFinished​(EventCountCircuitBreaker breaker,
                                               EventCountCircuitBreaker.CheckIntervalData currentData,
                                               long now)
        Returns a flag whether the end of the current check interval is reached.
        Parameters:
        breaker - the CircuitBreaker
        currentData - the current state object
        now - the current time
        Returns:
        a flag whether the end of the current check interval is reached
      • isStateTransition

        public abstract boolean isStateTransition​(EventCountCircuitBreaker breaker,
                                                  EventCountCircuitBreaker.CheckIntervalData currentData,
                                                  EventCountCircuitBreaker.CheckIntervalData nextData)
        Checks whether the specified CheckIntervalData objects indicate that a state transition should occur. Here the logic which checks for thresholds depending on the current state is implemented.
        Parameters:
        breaker - the CircuitBreaker
        currentData - the current CheckIntervalData object
        nextData - the updated CheckIntervalData object
        Returns:
        a flag whether a state transition should be performed
      • fetchCheckInterval

        protected abstract long fetchCheckInterval​(EventCountCircuitBreaker breaker)
        Obtains the check interval to applied for the represented state from the given CircuitBreaker.
        Parameters:
        breaker - the CircuitBreaker
        Returns:
        the check interval to be applied