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 completes after the timeout expires:
StackDepthException
created from exceptionFun
.StackDepthException
created from exceptionFun
that 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:
Future
will be completed with the return value of the function.Future
with that same exception.If the asynchronous function completes after the timeout expires:
Future
with a StackDepthException
created from exceptionFun
.Future
with a StackDepthException
created from exceptionFun
that 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:
FutureOutcome
will be completed with the Outcome
returned from the function.TestPendingException
, this method will complete the FutureOutcome
with Pending
.TestCanceledException
, this method will complete the FutureOutcome
with Canceled
that contains the thrown exception.FutureOutcome
with Failed
that contains the thrown exception.FutureOutcome
with ExecutionException
that contains the thrown exception.If the asynchronous function completes after the timeout expires:
FutureOutcome
with a Outcome
that's mapped from the exception thrown from exceptionFun
.FutureOutcome
with Outcome
that's mapped from the exception thrown from exceptionFun
that 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
.
Companion object for
Timed
typeclass that offers three implicit providers: one forFutureOutcome
, one forFuture
of any type, and one for any other type.The details are in the documentation for the implicit providers themselves (methods
timed
,timedFutureOf
, andtimedFutureOutcome
), but in short if a time limit is exceeded:T
inTimed[T]
isFutureOutcome
theFutureOutcome
returned bytimeoutAfter
will result in eitherFailed
orCanceled
Future[U]
, theFuture[U]
returned bytimeoutAfter
will fail with either aTestFailedDueToTimeoutException
or aTestCanceledException
.timeoutAfter
method will itself complete abruptly with eitherTestFailedDueToTimeoutException
orTestCanceledException.