Class BmcGenericRetrier

  • Direct Known Subclasses:
    TokenRefreshRetrier

    public class BmcGenericRetrier
    extends Object
    A generic retrier that can be used to implement custom retry behavior for specific types of calls.
    • Constructor Detail

      • BmcGenericRetrier

        public BmcGenericRetrier​(@Nonnull
                                 RetryConfiguration retryConfiguration)
        Creates a new retrier with the given configuration.
        Parameters:
        retryConfiguration - The retry configuration to use.
    • Method Detail

      • execute

        public <REQUEST,​RESPONSE> RESPONSE execute​(@Nonnull
                                                         REQUEST requestToUse,
                                                         @Nonnull
                                                         Function<REQUEST,​RESPONSE> functionCall)
        Executes the functionCall based upon the RetryConfiguration of this retrier
        Type Parameters:
        REQUEST - Request object class
        RESPONSE - Response object class
        Parameters:
        requestToUse - The request that is passed to the functionCall
        functionCall - Function that will be invoked to send out the request.
        Returns:
        The successful response
      • doFunctionCall

        protected <REQUEST,​RESPONSE> RESPONSE doFunctionCall​(@Nonnull
                                                                   REQUEST request,
                                                                   @Nonnull
                                                                   Function<REQUEST,​RESPONSE> functionCall)
        Executes the actual function call.

        Can be overridden, e.g. for debugging.

        Type Parameters:
        REQUEST - Request object class
        RESPONSE - Response object class
        Parameters:
        functionCall - Function that will be invoked to send out the request.
        request - request data for the function call
        Returns:
        The successful response
      • doFunctionCallAsync

        protected <REQUEST,​RESPONSE> CompletionStage<RESPONSE> doFunctionCallAsync​(@Nullable @Nonnull
                                                                                         REQUEST request,
                                                                                         @Nonnull
                                                                                         Function<REQUEST,​CompletionStage<RESPONSE>> functionCall)