Class OperationTimedOutException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.datastax.driver.core.exceptions.DriverException
-
- com.datastax.driver.core.exceptions.ConnectionException
-
- com.datastax.driver.core.exceptions.OperationTimedOutException
-
- All Implemented Interfaces:
CoordinatorException,Serializable
public class OperationTimedOutException extends ConnectionException
Thrown on a client-side timeout, i.e. when the client didn't hear back from the server withinSocketOptions.getReadTimeoutMillis().When the exception is thrown from the request execution path it carries additional diagnostic fields: the driver-side timeout that was configured for the request, the number of in-flight requests on the connection at the moment of the timeout, and the pool-level pending-borrow queue depth and total in-flight count. These fields are set to
UNAVAILABLEwhen the exception was not created through that path (e.g. when re-thrown or copied via legacy constructors).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intUNAVAILABLESentinel value returned bygetConfiguredTimeoutMs(),getConnectionInFlight(),getPoolPendingBorrows(), andgetPoolTotalInFlight()when the corresponding information was not available at the time the exception was created.
-
Constructor Summary
Constructors Constructor Description OperationTimedOutException(EndPoint endPoint)OperationTimedOutException(EndPoint endPoint, long configuredTimeoutMs, int connectionInFlight, int poolPendingBorrows, int poolTotalInFlight)Creates an exception with full diagnostic context captured at timeout time.OperationTimedOutException(EndPoint endPoint, String msg)OperationTimedOutException(EndPoint endPoint, String msg, Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OperationTimedOutExceptioncopy()Copy the exception.longgetConfiguredTimeoutMs()Returns the driver-side read timeout that was configured for the request, in milliseconds, orUNAVAILABLEif not available.intgetConnectionInFlight()Returns the number of in-flight requests on the connection at the time of the timeout, orUNAVAILABLEif not available.intgetPoolPendingBorrows()Returns the number of requests waiting to acquire a connection from the pool at the time of the timeout, orUNAVAILABLEif not available.intgetPoolTotalInFlight()Returns the total number of in-flight requests across all connections to the host at the time of the timeout, orUNAVAILABLEif not available.-
Methods inherited from class com.datastax.driver.core.exceptions.ConnectionException
getAddress, getEndPoint, getHost, getMessage
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNAVAILABLE
public static final int UNAVAILABLE
Sentinel value returned bygetConfiguredTimeoutMs(),getConnectionInFlight(),getPoolPendingBorrows(), andgetPoolTotalInFlight()when the corresponding information was not available at the time the exception was created.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OperationTimedOutException
public OperationTimedOutException(EndPoint endPoint)
-
OperationTimedOutException
public OperationTimedOutException(EndPoint endPoint, String msg, Throwable cause)
-
OperationTimedOutException
public OperationTimedOutException(EndPoint endPoint, long configuredTimeoutMs, int connectionInFlight, int poolPendingBorrows, int poolTotalInFlight)
Creates an exception with full diagnostic context captured at timeout time.- Parameters:
endPoint- the host that was being queried.configuredTimeoutMs- the driver-side read timeout that was in effect for this request, in milliseconds. Either the per-statement override (Statement.setReadTimeoutMillis(int)) or the driver-wide value fromSocketOptions.getReadTimeoutMillis().connectionInFlight- the number of in-flight requests on the connection at the time of the timeout.poolPendingBorrows- the number of requests waiting to acquire a connection from the pool at the time of the timeout. A non-zero value indicates pool contention.poolTotalInFlight- the total number of in-flight requests across all connections to this host at the time of the timeout.
-
-
Method Detail
-
getConfiguredTimeoutMs
public long getConfiguredTimeoutMs()
Returns the driver-side read timeout that was configured for the request, in milliseconds, orUNAVAILABLEif not available.
-
getConnectionInFlight
public int getConnectionInFlight()
Returns the number of in-flight requests on the connection at the time of the timeout, orUNAVAILABLEif not available.
-
getPoolPendingBorrows
public int getPoolPendingBorrows()
Returns the number of requests waiting to acquire a connection from the pool at the time of the timeout, orUNAVAILABLEif not available. A non-zero value indicates that requests were queued inside the driver before reaching the server.
-
getPoolTotalInFlight
public int getPoolTotalInFlight()
Returns the total number of in-flight requests across all connections to the host at the time of the timeout, orUNAVAILABLEif not available.
-
copy
public OperationTimedOutException copy()
Description copied from class:DriverExceptionCopy the exception.This returns a new exception, equivalent to the original one, except that because a new object is created in the current thread, the top-most element in the stacktrace of the exception will refer to the current thread (this is mainly intended for internal use by the driver). The cause of the copied exception will be the original exception.
- Overrides:
copyin classConnectionException- Returns:
- a copy/clone of this exception.
-
-