A template trait for Promises that are derived and capable of being detached from other Promises.
Indicates that an attempt to satisfy a com.twitter.util.Promise was made after that promise had already been satisfied.
Create a new, empty, promise of type {{A}}.
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(())
Single-arg version to avoid object creation and take advantage of forwardInterruptsTo
.
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 of fs do.