Package org.apache.hc.core5.util
Class TimeoutValueException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.util.concurrent.TimeoutException
org.apache.hc.core5.util.TimeoutValueException
- All Implemented Interfaces:
Serializable
A specialization of
TimeoutException
that carries a Timeout
deadline and the actual value.- Since:
- 5.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimeoutValueException
(Timeout deadline, Timeout actual) Creates a new exception for the given timeout deadline and actual timeout. -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeoutValueException
fromMilliseconds
(long timeoutDeadline, long timeoutActual) Creates a new exception for the given timeout deadline and actual timeout.Gets how long was the expected timeout in milliseconds.Gets how long we actually waited in milliseconds.private static long
min0
(long value) Returns the givenvalue
if positive, otherwise returns 0.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
actual
-
deadline
-
-
Constructor Details
-
TimeoutValueException
Creates a new exception for the given timeout deadline and actual timeout.- Parameters:
deadline
- How long was the expected timeout.actual
- How long we actually waited.
-
-
Method Details
-
fromMilliseconds
Creates a new exception for the given timeout deadline and actual timeout.- Parameters:
timeoutDeadline
- How long was the expected timeout in milliseconds.timeoutActual
- How long we actually waited in milliseconds.- Returns:
- a new TimeoutValueException.
-
min0
private static long min0(long value) Returns the givenvalue
if positive, otherwise returns 0.- Parameters:
value
- any timeout- Returns:
- the given
value
if positive, otherwise returns 0.
-
getActual
Gets how long was the expected timeout in milliseconds.- Returns:
- how long was the expected timeout in milliseconds.
-
getDeadline
Gets how long we actually waited in milliseconds.- Returns:
- how long we actually waited in milliseconds.
-