Interface IRetryHandler
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public interface IRetryHandler
Remarks
The driver supports automatic retrying of operations that fail with retryable exceptions. The following exceptions can be retried:
-
All subclasses of RetryableException. Their
IsRetryable property is always
true
. -
Instances of other subclasses of NoSQLException that
have IsRetryable equal
true
. Currently these include instances of ServiceResponseException with retryable HTTP status codes. See ServiceResponseException. - All network-related errors. Currently those are instances of HttpRequestException.
The driver uses the retry handler to control the number of retries as well as the frequency of retries (via the duration of a delay before the retry happens). For most applications, it is sufficient to use built-in retry handler implemented by NoSQLRetryHandler. It uses exponential back-off algorithm with special cases for certain operations and has customizable parameters. See NoSQLRetryHandler.
The retry handler instance is specified as RetryHandler in the initial configuration. You have the following options:
- Leave RetryHandler unset, in which case the driver will use an instance of NoSQLRetryHandler with default property values. This should be sufficient for most applications.
- Set RetryHandler to a new instance of NoSQLRetryHandler created with customized property values. This will allow you to customize such parameters as maximum number of retries, base delay between retries and retry delays for special situations.
- Create your own custom class implementing IRetryHandler and set its instance as RetryHandler. This allows for most customization of operation retries.
- If you want to disable operation retries altogether, set RetryHandler to NoRetries.
It is not recommended that applications rely on the retry handler for regulating provisioned throughput as this will result in low efficiency. It is best to add rate limiting to the application based on a table's capacity and access patterns to avoid throttling exceptions.
Instances of this interface will be shared between threads, so they must be immutable or otherwise thread-safe.
Methods
Name | Description |
---|---|
GetRetryDelay(Request) | Determines how long to wait between successive retries. |
ShouldRetry(Request) | Determines whether the operation should be retried. |