Class RetryEngine
java.lang.Object
com.cockroachlabs.crdb.retry.RetryEngine
Executes a unit of work, retrying on retryable CockroachDB anomalies with
AdaptiveBackoff. When attempts are exhausted it throws
CrdbException carrying a RetryExhausted anomaly.
The engine keeps a persistent AdaptiveBackoff so contention learned
from one operation informs the next.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAbstracts sleeping so tests can run without real delays. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Trun(RetryPolicy policy, Callable<T> work) Runwork, retrying on retryable anomalies perpolicy.
-
Constructor Details
-
RetryEngine
public RetryEngine() -
RetryEngine
- Parameters:
jitterSource- optional deterministic jitter source (may benull)sleeper- how to wait between attempts (inject a no-op in tests)
-
-
Method Details
-
run
Runwork, retrying on retryable anomalies perpolicy.- Throws:
CrdbException- with aRetryExhaustedanomaly when all attempts fail, or with the classified anomaly for a non-retryableSQLException
-