Package com.couchbase.client.core.error
Class TimeoutException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.couchbase.client.core.error.CouchbaseException
-
- com.couchbase.client.core.error.TimeoutException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AmbiguousTimeoutException,UnambiguousTimeoutException
public abstract class TimeoutException extends CouchbaseException
TheTimeoutExceptionsignals 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
CancellationErrorContextwhich contains lots of additional metadata. The context can also be accessed through thecontext()getter.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTimeoutException(String message, CancellationErrorContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CancellationErrorContextcontext()Returns the error context, if present.intretryAttempts()Returns the number of retry attempts for this request.Set<RetryReason>retryReasons()Returns the set of retry reasons for request.-
Methods inherited from class com.couchbase.client.core.error.CouchbaseException
getMessage
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
TimeoutException
protected TimeoutException(String message, CancellationErrorContext ctx)
-
-
Method Detail
-
context
@Uncommitted public CancellationErrorContext context()
Description copied from class:CouchbaseExceptionReturns the error context, if present.- Overrides:
contextin classCouchbaseException
-
retryReasons
@Uncommitted public Set<RetryReason> retryReasons()
Returns the set of retry reasons for request.- Returns:
- the set of retry reasons, might be empty.
-
retryAttempts
@Uncommitted public int retryAttempts()
Returns the number of retry attempts for this request.- Returns:
- the number of retry attempts, might be 0.
-
-