object Promise
- Alphabetic
- By Inheritance
- Promise
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait Detachable extends AnyRef
A template trait for Promises that are derived and capable of being detached from other Promises.
- case class ImmutableResult(message: String) extends Exception with Product with Serializable
Indicates that an attempt to satisfy a com.twitter.util.Promise was made after that promise had already been satisfied.
- trait InterruptHandler extends PartialFunction[Throwable, Unit]
Embeds an "interrupt handler" into a Promise.
Embeds an "interrupt handler" into a Promise.
This is a total handler such that it's defined on any
Throwable
. Use Promise.setInterruptHandler if you need to leave an interrupt handler undefined for certain types of exceptions.Example: (
p
andq
are equivalent, butp
allocates less):import com.twitter.util.Promise val p = new Promise[A] with Promise.InterruptHandler { def onInterrupt(t: Throwable): Unit = setException(t) } val q = new Promise[A] q.setInterruptHandler { case t: Throwable => q.setException(t) }
- Note
Later calls to
setInterruptHandler
on a promise mixing in this trait will replace the embedded handler.
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
- def apply[A](): Promise[A]
Create a new, empty, promise of type {{A}}.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attached[A](parent: Future[A]): Promise[A] with Detachable
Create a derivative promise that will be satisfied with the result of the parent.
Create a derivative promise that will be satisfied with the result of the parent.
If the derivative promise is detached before the parent is satisfied, then it becomes disconnected from the parent and can be used as a normal, unlinked Promise.
By the contract of
Detachable
, satisfaction of the Promise must occur after detachment. Promises should only ever be satisfied after they are successfully detached (thus satisfaction is the responsibility of the detacher).Ex:
val f: Future[Unit] val p: Promise[Unit] with Detachable = Promise.attached(f) ... if (p.detach()) p.setValue(())
- def clone(): AnyRef
- Attributes
- protected[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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def interrupts[A](fs: Future[_]*): Promise[A]
Create a promise that interrupts all of
fs
.Create a promise that interrupts all of
fs
. In particular: the returned promise handles an interrupt when any offs
do. - def interrupts[A](a: Future[_], b: Future[_]): Promise[A]
Create a promise that interrupts
a
andb
futures.Create a promise that interrupts
a
andb
futures. In particular: the returned promise handles an interrupt when eithera
orb
does.- See also
- def interrupts[A](f: Future[_]): Promise[A]
Single-arg version to avoid object creation and take advantage of
forwardInterruptsTo
.Single-arg version to avoid object creation and take advantage of
forwardInterruptsTo
. - 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
- 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()