Class RetryOnRateLimitConfig

  • All Implemented Interfaces:
    RequestConfiguration

    public class RetryOnRateLimitConfig
    extends Object
    implements RequestConfiguration
    Configuration for request re-try. The request will be tried up to {code maxAttempts} times with a wait between requests as directed by the remote server (defaults to 5s for Bitbucket Server). A retry will happen if the remote side responds with a HTTP status code of {code 429}. If the request is not successful within the allowed number of attempts an RateLimitedException is thrown.
    Since:
    3.1
    • Constructor Detail

      • RetryOnRateLimitConfig

        public RetryOnRateLimitConfig​(int maxAttempts)
        Parameters:
        maxAttempts - maximum number of times to attempt the request, inclusive.
    • Method Detail

      • apply

        public void apply​(okhttp3.Request.Builder builder)
        Description copied from interface: RequestConfiguration
        Update the supplied builder with the configuration required. The order in which configurations are applied is not defined nor guaranteed to be the same between invocations.
        Specified by:
        apply in interface RequestConfiguration
        Parameters:
        builder - the request builder, some RequestConfigurations may already have been applied to the builder
      • getAttempts

        public int getAttempts()
      • getMaxAttempts

        public int getMaxAttempts()
      • incrementAndGetAttempts

        public int incrementAndGetAttempts()