public abstract class TimeoutException extends CouchbaseException
TimeoutException
signals that an operation timed out before it could be completed.
It is important to understand that the timeout itself is always just the effect an underlying cause, never the issue itself. The root cause might not even be on the application side, also the network and server need to be taken into account.
Right now the SDK can throw two different implementations of this class:
AmbiguousTimeoutException
: The operation might have caused a side effect on the server and should not
be retried without additional actions and checks.UnambiguousTimeoutException
: The operation has not caused a side effect on the server and is safe
to retry. This is always the case for idempotent operations. For non-idempotent operations it depends on the state
the operation was in at the time of cancellation.
Usually it is helpful to inspect/log the full timeout exception, because it also logs the
CancellationErrorContext
which contains lots of additional metadata. The context can also be accessed
through the context()
getter.
Modifier | Constructor and Description |
---|---|
protected |
TimeoutException(String message,
CancellationErrorContext ctx) |
|
TimeoutException(String message,
Throwable cause,
boolean enableSuppression,
boolean writableStacktrace,
ErrorContext ctx) |
Modifier and Type | Method and Description |
---|---|
CancellationErrorContext |
context()
Returns the error context, if present.
|
int |
retryAttempts()
Returns the number of retry attempts for this request.
|
Set<RetryReason> |
retryReasons()
Returns the set of retry reasons for request.
|
getMessage
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
protected TimeoutException(String message, CancellationErrorContext ctx)
public TimeoutException(String message, Throwable cause, boolean enableSuppression, boolean writableStacktrace, ErrorContext ctx)
@Stability.Uncommitted public CancellationErrorContext context()
CouchbaseException
context
in class CouchbaseException
@Stability.Uncommitted public Set<RetryReason> retryReasons()
@Stability.Uncommitted public int retryAttempts()
Copyright © 2024 Couchbase, Inc.. All rights reserved.