Package com.oracle.bmc.retrier
Class BmcGenericRetrier
- java.lang.Object
-
- com.oracle.bmc.retrier.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 Summary
Constructors Constructor Description BmcGenericRetrier(RetryConfiguration retryConfiguration)Creates a new retrier with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <REQUEST,RESPONSE>
RESPONSEdoFunctionCall(REQUEST request, Function<REQUEST,RESPONSE> functionCall)Executes the actual function call.protected <REQUEST,RESPONSE>
CompletionStage<RESPONSE>doFunctionCallAsync(REQUEST request, Function<REQUEST,CompletionStage<RESPONSE>> functionCall)<REQUEST,RESPONSE>
RESPONSEexecute(REQUEST requestToUse, Function<REQUEST,RESPONSE> functionCall)Executes the functionCall based upon theRetryConfigurationof this retrier<REQUEST,RESPONSE>
CompletionStage<RESPONSE>executeAsync(WaiterScheduler runner, REQUEST requestToUse, Function<REQUEST,CompletionStage<RESPONSE>> functionCall)RetryConditiongetRetryCondition()GenericWaitergetWaiter()
-
-
-
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 theRetryConfigurationof this retrier- Type Parameters:
REQUEST- Request object classRESPONSE- Response object class- Parameters:
requestToUse- The request that is passed to the functionCallfunctionCall- Function that will be invoked to send out the request.- Returns:
- The successful response
-
executeAsync
public final <REQUEST,RESPONSE> CompletionStage<RESPONSE> executeAsync(WaiterScheduler runner, @Nonnull REQUEST requestToUse, @Nonnull Function<REQUEST,CompletionStage<RESPONSE>> functionCall)
-
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 classRESPONSE- 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)
-
getWaiter
public GenericWaiter getWaiter()
-
getRetryCondition
public RetryCondition getRetryCondition()
-
-