Package oracle.nosql.driver
Interface RetryHandler
- All Known Implementing Classes:
- DefaultRetryHandler
public interface RetryHandler
RetryHandler is called by the request handling system when a
 
RetryableException is thrown. It controls the number of retries
 as well as frequency of retries using a delaying algorithm. A default
 RetryHandler is always configured on a NoSQLHandle instance and
 can be controlled or overridden using
 NoSQLHandleConfig.setRetryHandler(oracle.nosql.driver.RetryHandler) and
 NoSQLHandleConfig.configureDefaultRetryHandler(int, int)
 
 It is not recommended that applications rely on a RetryHandler for
 regulating provisioned throughput. It is best to add rate limiting to the
 application based on a table's capacity and access patterns to avoid
 throttling exceptions: see NoSQLHandleConfig.setRateLimitingEnabled(boolean).
 
Instances of this interface must be immutable so they can be shared among threads.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddelay(Request request, int numRetries, RetryableException re) This method is called when aRetryableExceptionis thrown and it is determined that the request will be retried based on the return value ofdoRetry(oracle.nosql.driver.ops.Request, int, oracle.nosql.driver.RetryableException).booleandoRetry(Request request, int numRetries, RetryableException re) This method is called when aRetryableExceptionis thrown and determines whether to perform a retry or not based on the parameters.intReturns the number of retries that this handler instance will allow before the exception is thrown to the application.
- 
Method Details- 
getNumRetriesint getNumRetries()Returns the number of retries that this handler instance will allow before the exception is thrown to the application.- Returns:
- the max number of retries
 
- 
doRetryThis method is called when aRetryableExceptionis thrown and determines whether to perform a retry or not based on the parameters.- Parameters:
- request- the Request that has triggered the exception
- numRetries- the number of retries that have occurred for the operation
- re- 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.
 
- 
delayThis method is called when aRetryableExceptionis thrown and it is determined that the request will be retried based on the return value ofdoRetry(oracle.nosql.driver.ops.Request, int, oracle.nosql.driver.RetryableException). It provides a delay between retries. Most implementations will sleep for some period of time. The method should not return until the desired delay period has passed. Implementations should not busy-wait in a tight loop.- Parameters:
- request- the Request that has triggered the exception
- numRetries- the number of retries that have occurred for the operation
- re- the exception that was thrown
 
 
-