Packages

  • package root
    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package compat
    Definition Classes
    scala
  • package java8
    Definition Classes
    compat
  • object FutureConverters

    This class contains static methods which convert between Java CompletionStage and Scala Future.

    This class contains static methods which convert between Java CompletionStage and Scala Future. This is useful when mediating between Scala and Java libraries with asynchronous APIs.

    Note that the bridge is implemented at the read-only side of asynchronous handles, namely scala.concurrent.Future instead of scala.concurrent.Promise and CompletionStage instead of CompletableFuture. This is intentional, as the semantics of bridging the write-handles would be prone to race conditions; if both ends (CompletableFuture and Promise) are completed independently at the same time, they may contain different values afterwards. For this reason, toCompletableFuture() is not supported on the created CompletionStages.

    Example usage:

    import java.util.concurrent.CompletionStage;
    import scala.concurrent.Future;
    import static scala.concurrent.java8.FutureConverters.*;
    
    final CompletionStage<String> cs = ... // from an async Java API
    final Future<String> f = toScala(cs);
    ...
    final Future<Integer> f2 = ... // from an async Scala API
    final CompletionStage<Integer> cs2 = toJava(f2);
    Definition Classes
    java8
  • CompletionStageOps
  • FutureOps

final class FutureOps[T] extends AnyVal

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FutureOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new FutureOps(__self: Future[T])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. val __self: Future[T]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. def toJava: CompletionStage[T]

    Returns a CompletionStage that will be completed with the same value or exception as the given Scala Future when that completes.

    Returns a CompletionStage that will be completed with the same value or exception as the given Scala Future when that completes. Since the Future is a read-only representation, this CompletionStage does not support the toCompletableFuture method. The semantics of Scala Future demand that all callbacks are invoked asynchronously by default, therefore the returned CompletionStage routes all calls to synchronous transformations to their asynchronous counterparts, i.e. thenRun will internally call thenRunAsync.

    returns

    a CompletionStage that runs all callbacks asynchronously and does not support the CompletableFuture interface

  9. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped