Promise.Control

trait Control[A]

Promise control provides the ability to "complete" the controlled promise instance.

For each promise, there is a control, which is not part of promise API, it is a behind the scenes handle for code fulfilling the promise.

Source
Control.scala
class java.lang.Object
trait scala.Matchable
class Any

Def

def complete(v: Result[A]): Boolean

Provide result

Provide result

Fulfills promise with given result

Returns false if the result is already complete

Source
Control.scala
def promise: Promise[A]

Controlled promise

Controlled promise

Returns promise attached to this control. There is one to one relation.

Source
Control.scala
def tryComplete(expression: => Result[A]): Boolean

Try provide result

Try provide result

Same as complete, but with try-catch block, which will handle any runtime exceptions and turn them into result with problem.

Source
Control.scala