trait FutureConcept[T] extends AnyRef
Concept trait for futures, instances of which are passed to the whenReady
methods of trait Futures
.
See the documentation for trait Futures
for the details on the syntax this trait
provides for testing with futures.
- Self Type
- FutureConcept[T]
- Source
- Futures.scala
- Alphabetic
- By Inheritance
- FutureConcept
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def eitherValue: Option[Either[Throwable, T]]
Queries this future for its value.
Queries this future for its value.
If the future is not ready, this method will return
None
. If ready, it will either return an exception or aT
. - abstract def isCanceled: Boolean
Indicates whether this future has been canceled.
Indicates whether this future has been canceled.
If the underlying future does not support the concept of cancellation, this method must always return
false
. - abstract def isExpired: Boolean
Indicates whether this future has expired (timed out).
Indicates whether this future has expired (timed out).
The timeout detected by this method is different from the timeout supported by
whenReady
. This timeout is a timeout of the underlying future. If the underlying future does not support timeouts, this method must always returnfalse
.
Concrete 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
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def futureValue(implicit config: Futures.PatienceConfig, pos: Position): T
Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,futureValue
returned aLeft
) orTestFailedException
.Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,futureValue
returned aLeft
) orTestFailedException
.This trait's implementation of this method queries the future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, returns the future's value. For greater efficiency, implementations of this trait may override this method so that it blocks the specified timeout while waiting for the result, if the underlying future supports this.
The maximum amount of time to wait for the future to become ready before giving up and throwing
TestFailedException
is configured by thetimeout
field of thePatienceConfig
passed implicitly as the last parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by theinterval
field of thePatienceConfig
passed implicitly as the last parameter.If the
eitherValue
method of the underlying Scala future returns ascala.Some
containing ascala.util.Failure
containing ajava.util.concurrent.ExecutionException
, and this exception contains a non-null
cause, that cause will be included in theTestFailedException
as its cause. TheExecutionException
will be be included as theTestFailedException
's cause only if theExecutionException
's cause isnull
.- config
a
PatienceConfig
object containingtimeout
andinterval
parameters that are unused by this method- returns
the result of the future once it is ready, if
value
is defined as aRight
- Exceptions thrown
TestFailedException
if the future is cancelled, expires, or is still not ready after the specified timeout has been exceededThrowable
if once ready, thevalue
of this future is defined as aLeft
(in this case, this method throws that same exception)
- final def futureValue(interval: Interval)(implicit config: Futures.PatienceConfig, pos: Position): T
Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,eitherValue
returned aLeft
) orTestFailedException
.Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,eitherValue
returned aLeft
) orTestFailedException
.The maximum amount of time to wait for the future to become ready before giving up and throwing
TestFailedException
is configured by thetimeout
field of thePatienceConfig
passed implicitly as the last parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the value contained in the passedinterval
parameter.This method invokes the overloaded
futureValue
form with only one (implicit) argument list that contains only one argument, aPatienceConfig
, passing a newPatienceConfig
with theInterval
specified asinterval
and theTimeout
specified asconfig.timeout
.If the
eitherValue
method of the underlying Scala future returns ascala.Some
containing ascala.util.Failure
containing ajava.util.concurrent.ExecutionException
, and this exception contains a non-null
cause, that cause will be included in theTestFailedException
as its cause. TheExecutionException
will be be included as theTestFailedException
's cause only if theExecutionException
's cause isnull
.- interval
the
Interval
configuration parameter- config
an
PatienceConfig
object containingtimeout
andinterval
parameters that are unused by this method- returns
the result of the future once it is ready, if
value
is defined as aRight
- Exceptions thrown
TestFailedException
if the future is cancelled, expires, or is still not ready after the specified timeout has been exceededThrowable
if once ready, thevalue
of this future is defined as aLeft
(in this case, this method throws that same exception)
- final def futureValue(timeout: Timeout)(implicit config: Futures.PatienceConfig, pos: Position): T
Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,value
returned aLeft
) orTestFailedException
.Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,value
returned aLeft
) orTestFailedException
.The maximum amount of time to wait for the future to become ready before giving up and throwing
TestFailedException
is configured by the value contained in the passedtimeout
parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by theinterval
field of thePatienceConfig
passed implicitly as the last parameter.This method invokes the overloaded
futureValue
form with only one (implicit) argument list that contains only one argument, aPatienceConfig
, passing a newPatienceConfig
with theTimeout
specified astimeout
and theInterval
specified asconfig.interval
.If the
eitherValue
method of the underlying Scala future returns ascala.Some
containing ascala.util.Failure
containing ajava.util.concurrent.ExecutionException
, and this exception contains a non-null
cause, that cause will be included in theTestFailedException
as its cause. TheExecutionException
will be be included as theTestFailedException
's cause only if theExecutionException
's cause isnull
.- timeout
the
Timeout
configuration parameter- config
an
PatienceConfig
object containingtimeout
andinterval
parameters that are unused by this method- returns
the result of the future once it is ready, if
eitherValue
is defined as aRight
- Exceptions thrown
TestFailedException
if the future is cancelled, expires, or is still not ready after the specified timeout has been exceededThrowable
if once ready, theeitherValue
of this future is defined as aLeft
(in this case, this method throws that same exception)
- final def futureValue(timeout: Timeout, interval: Interval)(implicit pos: Position): T
Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,value
returned aLeft
) orTestFailedException
.Returns the result of this
FutureConcept
, once it is ready, or throws either the exception returned by the future (i.e.,value
returned aLeft
) orTestFailedException
.The maximum amount of time to wait for the future to become ready before giving up and throwing
TestFailedException
is configured by the value contained in the passedtimeout
parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the value contained in the passedinterval
parameter.This method invokes the overloaded
futureValue
form with only one (implicit) argument list that contains only one argument, aPatienceConfig
, passing a newPatienceConfig
with theTimeout
specified astimeout
and theInterval
specified asinterval
.If the
eitherValue
method of the underlying Scala future returns ascala.Some
containing ascala.util.Failure
containing ajava.util.concurrent.ExecutionException
, and this exception contains a non-null
cause, that cause will be included in theTestFailedException
as its cause. TheExecutionException
will be be included as theTestFailedException
's cause only if theExecutionException
's cause isnull
.- timeout
the
Timeout
configuration parameter- interval
the
Interval
configuration parameter- returns
the result of the future once it is ready, if
value
is defined as aRight
- Exceptions thrown
TestFailedException
if the future is cancelled, expires, or is still not ready after the specified timeout has been exceededThrowable
if once ready, thevalue
of this future is defined as aLeft
(in this case, this method throws that same exception)
- final def getClass(): Class[_ <: AnyRef]
- 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 isReadyWithin(timeout: Span)(implicit config: Futures.PatienceConfig, pos: Position): Boolean
Indicates whether this future is ready within the specified timeout.
Indicates whether this future is ready within the specified timeout.
If the
eitherValue
method of the underlying Scala future returns ascala.Some
containing ascala.util.Failure
containing ajava.util.concurrent.ExecutionException
, and this exception contains a non-null
cause, that cause will be included in theTestFailedException
as its cause. TheExecutionException
will be be included as theTestFailedException
's cause only if theExecutionException
's cause isnull
. - 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
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()