Package oracle.nosql.driver
Class DefaultRetryHandler
- java.lang.Object
 - 
- oracle.nosql.driver.DefaultRetryHandler
 
 
- 
- All Implemented Interfaces:
 RetryHandler
public class DefaultRetryHandler extends Object implements RetryHandler
Default retry handler. This may be extended by clients for specific use cases. The default retry handler decides when and for how long retries will be attempted. SeeRetryHandlerfor more information on retry handlers. 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcomputeBackoffDelay(Request request, int fixedDelayMs)Compute an incremental backoff delay in milliseconds.voiddelay(Request request, int numRetries, RetryableException re)Delay (sleep) during retry cycle.booleandoRetry(Request request, int numRetries, RetryableException re)Decide whether to retry or not.intgetNumRetries()Returns the number of retries that this handler instance will allow before the exception is thrown to the application. 
 - 
 
- 
- 
Method Detail
- 
getNumRetries
public int getNumRetries()
Description copied from interface:RetryHandlerReturns the number of retries that this handler instance will allow before the exception is thrown to the application.- Specified by:
 getNumRetriesin interfaceRetryHandler- Returns:
 - the max number of retries
 
 
- 
doRetry
public boolean doRetry(Request request, int numRetries, RetryableException re)
Decide whether to retry or not. Default behavior is to *not* retry OperationThrottlingException because the retry time is likely much longer than normal because they are DDL operations. Read and Write throttling exceptions are always retryable. Otherwise check the request itself to see if it should not be retried.- Specified by:
 doRetryin interfaceRetryHandler- Parameters:
 request- the Request that has triggered the exceptionnumRetries- the number of retries that have occurred for the operationre- the exception that was thrown- Returns:
 - true if the operation should be retried, false if not, causing the exception to be thrown to the application.
 
 
- 
delay
public void delay(Request request, int numRetries, RetryableException re)
Delay (sleep) during retry cycle. If delayMS is non-zero, use it. Otherwise, use an incremental backoff algorithm to compute the time of delay.- Specified by:
 delayin interfaceRetryHandler- Parameters:
 request- the Request that has triggered the exceptionnumRetries- the number of retries that have occurred for the operationre- the exception that was thrown
 
- 
computeBackoffDelay
public static int computeBackoffDelay(Request request, int fixedDelayMs)
Compute an incremental backoff delay in milliseconds. This method also checks the request's timeout and ensures the delay will not exceed the specified timeout.- Parameters:
 request- The request object being executedfixedDelayMs- A specific delay to use and check for timeout. Pass zero to use the default backoff logic.- Returns:
 - The number of milliseconds to delay. If zero, do not delay at all.
 
 
 - 
 
 -