Annotation Interface BucketToken


@Documented @Retention(RUNTIME) @Target({ANNOTATION_TYPE,METHOD}) public @interface BucketToken
Annotation indicating that the current annotated method or all methods of the annotated class are protected with "Token-bucket" rate-limiting algorithm. If no fallback method was specified, the exception NoEnoughTokensAvailable will be thrown.
Since:
1.9.0
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the bucket to be used.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Name of the fallback method to use when "Token-bucket" rate-limiting algorithm block access to the protected method.
    int
    Number of token to consume to execute protected method.
  • Element Details

    • value

      String value
      Name of the bucket to be used. Bucket must be configured or an exception will be thrown.
      Returns:
      Name of the bucket to be used
      Since:
      1.9.0
    • fallbackMethod

      String fallbackMethod
      Name of the fallback method to use when "Token-bucket" rate-limiting algorithm block access to the protected method. If there are multiple methods matching given name, the method that has the most-closest match will be invoked. The method could have no arguments or only one: the exception NoEnoughTokensAvailable.
      Returns:
      Name of the fallback method
      Since:
      1.9.0
      See Also:
      Default:
      ""
    • tokenToConsume

      int tokenToConsume
      Number of token to consume to execute protected method.
      Returns:
      Number of token to consume
      Since:
      1.9.0
      Default:
      1