Annotation Type CircuitBreaker


  • @Documented
    @Retention(RUNTIME)
    @Target({METHOD,TYPE,ANNOTATION_TYPE})
    @Retryable
    public @interface CircuitBreaker
    Variation of Retryable that implements the Circuit Breaker pattern. Has higher overhead than Retryable as a CircuitState has to be maintained for each method call
    Since:
    1.0
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      @Digits(integer=4,fraction=0) java.lang.String attempts  
      java.lang.String delay  
      java.lang.Class<? extends java.lang.Throwable>[] excludes  
      java.lang.Class<? extends java.lang.Throwable>[] includes  
      java.lang.String maxDelay
      The maximum overall delay for an operation to complete until the Circuit state is set to CircuitState.OPEN.
      @Digits(integer=2,fraction=2) java.lang.String multiplier  
      java.lang.Class<? extends RetryPredicate> predicate  
      java.lang.String reset
      Sets the Duration of time before resetting the circuit to CircuitState.HALF_OPEN allowing a single retry.
      boolean throwWrappedException
      If true and the circuit is opened, it throws the original exception wrapped.
    • Field Detail

      • MAX_RETRY_ATTEMPTS

        static final int MAX_RETRY_ATTEMPTS
    • Element Detail

      • includes

        @AliasFor(annotation=Retryable.class,
                  member="includes")
        java.lang.Class<? extends java.lang.Throwable>[] includes
        Returns:
        The exception types to include (defaults to all)
        Default:
        {}
      • excludes

        @AliasFor(annotation=Retryable.class,
                  member="excludes")
        java.lang.Class<? extends java.lang.Throwable>[] excludes
        Returns:
        The exception types to exclude (defaults to none)
        Default:
        {}
      • attempts

        @Digits(integer=4,
                fraction=0)
        @AliasFor(annotation=Retryable.class,
                  member="attempts")
        @Digits(integer=4,fraction=0) java.lang.String attempts
        Returns:
        The maximum number of retry attempts
        Default:
        "3"
      • delay

        @AliasFor(annotation=Retryable.class,
                  member="delay")
        java.lang.String delay
        Returns:
        The delay between retry attempts
        Default:
        "500ms"
      • multiplier

        @Digits(integer=2,
                fraction=2)
        @AliasFor(annotation=Retryable.class,
                  member="multiplier")
        @Digits(integer=2,fraction=2) java.lang.String multiplier
        Returns:
        The multiplier to use to calculate the delay between retries.
        Default:
        "0"
      • maxDelay

        @AliasFor(annotation=Retryable.class,
                  member="maxDelay")
        java.lang.String maxDelay
        The maximum overall delay for an operation to complete until the Circuit state is set to CircuitState.OPEN.
        Returns:
        The maximum overall delay
        Default:
        "5s"
      • reset

        java.lang.String reset
        Sets the Duration of time before resetting the circuit to CircuitState.HALF_OPEN allowing a single retry.
        Returns:
        The Duration of time before reset
        Default:
        "20s"
      • throwWrappedException

        boolean throwWrappedException
        If true and the circuit is opened, it throws the original exception wrapped. in a CircuitOpenException
        Returns:
        Whether to wrap the original exception in a CircuitOpenException
        Default:
        false