Companion object for Timed typeclass that offers three implicit providers: one for FutureOutcome,
one for Future of any type, and one for any other type.
The details are in the documentation for the implicit providers themselves (methods timed, timedFutureOf,
and timedFutureOutcome), but in short if a time limit is exceeded:
-
if the type
TinTimed[T]isFutureOutcometheFutureOutcomereturned bytimeoutAfterwill result in eitherFailedorCanceled -
if the type is
Future[U], theFuture[U]returned bytimeoutAfterwill fail with either aTestFailedDueToTimeoutExceptionor aTestCanceledException. -
otherwise, the
timeoutAftermethod will itself complete abruptly with eitherTestFailedDueToTimeoutExceptionorTestCanceledException.
- Companion:
- class
Implicits
Implicits
Implicit method that provides Timed implementation for any T.
Implicit method that provides Timed implementation for any T.
If the function completes before the timeout expires:
-
If the function returns normally, this method will return normally.
-
If the function completes abruptly with an exception, this method will complete abruptly with that same exception.
If the function completes after the timeout expires:
-
If the function returns normally, this method will complete abruptly with a
StackDepthExceptioncreated fromexceptionFun. -
If the function completes abruptly with an exception, this method will complete abruptly with a
StackDepthExceptioncreated fromexceptionFunthat includes the exception thrown by the function as its cause.
This implementation will start a timer that when the time limit is exceeded while the passed in function f is still running, it will attempt to call the passed in Signaler to signal/interrupt the running function f.
Implicit method that provides Timed implementation for any Future[T].
Implicit method that provides Timed implementation for any Future[T].
If the asynchronous function completes before the timeout expires:
-
If the function returns normally, the
Futurewill be completed with the return value of the function. -
If the function completes abruptly with an exception, this method will complete the
Futurewith that same exception.
If the asynchronous function completes after the timeout expires:
-
If the function returns normally, this method will complete the
Futurewith aStackDepthExceptioncreated fromexceptionFun. -
If the function completes abruptly with an exception, this method will complete the
Futurewith aStackDepthExceptioncreated fromexceptionFunthat includes the exception thrown by the function as its cause.
This implementation will start a timer that when the time limit is exceeded while the passed in asynchronous function f is still running, it will attempt to call the passed in Signaler to signal/interrupt the running function f.
Implicit method that provides Timed implementation for FutureOutcome.
Implicit method that provides Timed implementation for FutureOutcome.
If the asynchronous function completes before the timeout expires:
-
If the function returns normally, the
FutureOutcomewill be completed with theOutcomereturned from the function. -
If the function completes abruptly with an
TestPendingException, this method will complete theFutureOutcomewithPending. -
If the function completes abruptly with an
TestCanceledException, this method will complete theFutureOutcomewithCanceledthat contains the thrown exception. -
If the function completes abruptly with a run-aborting exception, this method will complete the
FutureOutcomewithFailedthat contains the thrown exception. -
If the function completes abruptly with a non-run-aborting exception, this method will fail the
FutureOutcomewithExecutionExceptionthat contains the thrown exception.
If the asynchronous function completes after the timeout expires:
-
If the function returns normally, this method will complete the
FutureOutcomewith aOutcomethat's mapped from the exception thrown fromexceptionFun. -
If the function completes abruptly with an exception, this method will complete the
FutureOutcomewithOutcomethat's mapped from the exception thrown fromexceptionFunthat includes the exception thrown by the function as its cause.
This implementation will start a timer that when the time limit is exceeded while the passed in asynchronous function f is still running, it will attempt to call the passed in Signaler to signal/interrupt the running function f.