scala.concurrent

# Promise

#### trait Promise[T] extends AnyRef

Promise is an object which can be completed with a value or failed with an exception.

Source
  Promise.scala

Linear Supertypes
AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. Promise
2. AnyRef
3. Any

Implicitly

1. by any2stringadd
2. by StringFormat
3. by Ensuring
4. by ArrowAssoc

1. Hide All
2. Show all

Learn more about member selection
Visibility

1. Public
2. All

### Abstract Value Members

1. #### abstract def future: Future[T]

   Future containing the value of this promise.

2. #### abstract def isCompleted: Boolean

   Returns whether the promise has already been completed with a value or an exception.

   Returns whether the promise has already been completed with a value or an exception.

   Note: Using this method may result in non-deterministic concurrent programs.

   returns

     `true` if the promise is already completed, `false` otherwise

3. #### abstract def tryComplete(result: Try[T]): Boolean

   Tries to complete the promise with either a value or the exception.

   Tries to complete the promise with either a value or the exception.

   Note: Using this method may result in non-deterministic concurrent programs.

   returns

     If the promise has already been completed returns `false`, or `true` otherwise.

### Concrete Value Members

1. #### final def !=(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

2. #### final def ##(): Int

   Definition Classes
     AnyRef → Any

3. #### def +(other: String): String

   Implicit information
     This member is added by an implicit conversion from Promise[T] to any2stringadd[Promise[T]] performed by method any2stringadd in scala.Predef.
   Definition Classes
     any2stringadd

4. #### def ->[B](y: B): (Promise[T], B)

   Implicit information
     This member is added by an implicit conversion from Promise[T] to ArrowAssoc[Promise[T]] performed by method ArrowAssoc in scala.Predef.
   Definition Classes
     ArrowAssoc
   Annotations
     @inline()

5. #### final def ==(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

6. #### final def asInstanceOf[T0]: T0

   Definition Classes
     Any

7. #### def clone(): AnyRef

   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )

8. #### def complete(result: Try[T]): Promise.this.type

   Completes the promise with either an exception or a value.

   Completes the promise with either an exception or a value.

   result

     Either the value or the exception to complete the promise with.

     If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

9. #### final def completeWith(other: Future[T]): Promise.this.type

   Completes this promise with the specified future, once that future is completed.

   Completes this promise with the specified future, once that future is completed.

   returns

     This promise

10. #### def ensuring(cond: (Promise[T]) ⇒ Boolean, msg: ⇒ Any): Promise[T]

    Implicit information
      This member is added by an implicit conversion from Promise[T] to Ensuring[Promise[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring

11. #### def ensuring(cond: (Promise[T]) ⇒ Boolean): Promise[T]

    Implicit information
      This member is added by an implicit conversion from Promise[T] to Ensuring[Promise[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring

12. #### def ensuring(cond: Boolean, msg: ⇒ Any): Promise[T]

    Implicit information
      This member is added by an implicit conversion from Promise[T] to Ensuring[Promise[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring

13. #### def ensuring(cond: Boolean): Promise[T]

    Implicit information
      This member is added by an implicit conversion from Promise[T] to Ensuring[Promise[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring

14. #### final def eq(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

15. #### def equals(arg0: Any): Boolean

    Definition Classes
      AnyRef → Any

16. #### def failure(cause: Throwable): Promise.this.type

    Completes the promise with an exception.

    Completes the promise with an exception.

    cause

      The throwable to complete the promise with.

      If the throwable used to fail this promise is an error, a control exception or an interrupted exception, it will be wrapped as a cause within an `ExecutionException` which will fail the promise.

      If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

17. #### def finalize(): Unit

    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )

18. #### def formatted(fmtstr: String): String

    Returns string formatted according to given `format` string.

    Returns string formatted according to given `format` string. Format strings are as for `String.format` (@see java.lang.String.format).

    Implicit information
      This member is added by an implicit conversion from Promise[T] to StringFormat[Promise[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
      StringFormat
    Annotations
      @inline()

19. #### final def getClass(): Class[_]

    Definition Classes
      AnyRef → Any

20. #### def hashCode(): Int

    Definition Classes
      AnyRef → Any

21. #### final def isInstanceOf[T0]: Boolean

    Definition Classes
      Any

22. #### final def ne(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

23. #### final def notify(): Unit

    Definition Classes
      AnyRef

24. #### final def notifyAll(): Unit

    Definition Classes
      AnyRef

25. #### def success(value: T): Promise.this.type

    Completes the promise with a value.

    Completes the promise with a value.

    value

      The value to complete the promise with.

      If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

26. #### final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
      AnyRef

27. #### def toString(): String

    Definition Classes
      AnyRef → Any

28. #### final def tryCompleteWith(other: Future[T]): Promise.this.type

    Attempts to complete this promise with the specified future, once that future is completed.

    Attempts to complete this promise with the specified future, once that future is completed.

    returns

      This promise

29. #### def tryFailure(cause: Throwable): Boolean

    Tries to complete the promise with an exception.

    Tries to complete the promise with an exception.

    Note: Using this method may result in non-deterministic concurrent programs.

    returns

      If the promise has already been completed returns `false`, or `true` otherwise.

30. #### def trySuccess(value: T): Boolean

    Tries to complete the promise with a value.

    Tries to complete the promise with a value.

    Note: Using this method may result in non-deterministic concurrent programs.

    returns

      If the promise has already been completed returns `false`, or `true` otherwise.

31. #### final def wait(): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

32. #### final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

33. #### final def wait(arg0: Long): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

34. #### def →[B](y: B): (Promise[T], B)

    Implicit information
      This member is added by an implicit conversion from Promise[T] to ArrowAssoc[Promise[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
      ArrowAssoc

### Inherited from AnyRef

### Inherited from Any

### Inherited by implicit conversion any2stringadd from Promise[T] to any2stringadd[Promise[T]]

### Inherited by implicit conversion StringFormat from Promise[T] to StringFormat[Promise[T]]

### Inherited by implicit conversion Ensuring from Promise[T] to Ensuring[Promise[T]]

### Inherited by implicit conversion ArrowAssoc from Promise[T] to ArrowAssoc[Promise[T]]

### Ungrouped