object Timed
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
T
inTimed[T]
isFutureOutcome
theFutureOutcome
returned bytimeoutAfter
will result in eitherFailed
orCanceled
- if the type is
Future[U]
, theFuture[U]
returned bytimeoutAfter
will fail with either aTestFailedDueToTimeoutException
or aTestCanceledException
. - otherwise, the
timeoutAfter
method will itself complete abruptly with eitherTestFailedDueToTimeoutException
orTestCanceledException.
- Source
- Timed.scala
- Alphabetic
- By Inheritance
- Timed
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
implicit
def
timed[T]: Timed[T]
Implicit method that provides
Timed
implementation for anyT
.Implicit method that provides
Timed
implementation for anyT
.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
StackDepthException
created fromexceptionFun
. - If the function completes abruptly with an exception, this method will complete abruptly with a
StackDepthException
created fromexceptionFun
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 inSignaler
to signal/interrupt the running functionf
. -
implicit
def
timedFutureOf[T](implicit executionContext: ExecutionContext): Timed[Future[T]]
Implicit method that provides
Timed
implementation for anyFuture[T]
.Implicit method that provides
Timed
implementation for anyFuture[T]
.If the asynchronous function completes before the timeout expires:
- If the function returns normally, the
Future
will be completed with the return value of the function. - If the function completes abruptly with an exception, this method will complete the
Future
with that same exception.
If the asynchronous function completes after the timeout expires:
- If the function returns normally, this method will complete the
Future
with aStackDepthException
created fromexceptionFun
. - If the function completes abruptly with an exception, this method will complete the
Future
with aStackDepthException
created fromexceptionFun
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 inSignaler
to signal/interrupt the running functionf
. - If the function returns normally, the
-
implicit
def
timedFutureOutcome(implicit executionContext: ExecutionContext): Timed[FutureOutcome]
Implicit method that provides
Timed
implementation forFutureOutcome
.Implicit method that provides
Timed
implementation forFutureOutcome
.If the asynchronous function completes before the timeout expires:
- If the function returns normally, the
FutureOutcome
will be completed with theOutcome
returned from the function. - If the function completes abruptly with an
TestPendingException
, this method will complete theFutureOutcome
withPending
. - If the function completes abruptly with an
TestCanceledException
, this method will complete theFutureOutcome
withCanceled
that contains the thrown exception. - If the function completes abruptly with a run-aborting exception, this method will complete the
FutureOutcome
withFailed
that contains the thrown exception. - If the function completes abruptly with a non-run-aborting exception, this method will fail the
FutureOutcome
withExecutionException
that contains the thrown exception.
If the asynchronous function completes after the timeout expires:
- If the function returns normally, this method will complete the
FutureOutcome
with aOutcome
that's mapped from the exception thrown fromexceptionFun
. - If the function completes abruptly with an exception, this method will complete the
FutureOutcome
withOutcome
that's mapped from the exception thrown fromexceptionFun
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 inSignaler
to signal/interrupt the running functionf
. - If the function returns normally, the
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )