Package akka.pattern

Class PromiseRefImpl<T>

  • All Implemented Interfaces:
    FutureRef<T>, PromiseRef<T>
    Direct Known Subclasses:
    AskPromiseRef

    public class PromiseRefImpl<T>
    extends java.lang.Object
    implements PromiseRef<T>, FutureRef<T>
    Constructs a new PromiseRef which will be completed with the first message sent to it.

    
     // enables transparent use of FutureRef as ActorRef and Promise
     import FutureRef.Implicits._
    
     // requires an implicit ActorSystem in scope
     val futureRef = FutureRef(5.seconds)
     futureRef ! "message"
     futureRef.onComplete(println)  // prints "message"
     
    • Constructor Summary

      Constructors 
      Constructor Description
      PromiseRefImpl​(ActorRef ref, scala.concurrent.Promise<T> promise)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      scala.concurrent.Promise<T> promise()
      Promise associated with this PromiseRef.
      ActorRef ref()
      ActorRef associated with this PromiseRef.
      FutureRef<T> toFutureRef()
      Converts this PromiseRef to FutureRef, effectively narrowing it's API.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PromiseRefImpl

        public PromiseRefImpl​(ActorRef ref,
                              scala.concurrent.Promise<T> promise)
    • Method Detail

      • promise

        public scala.concurrent.Promise<T> promise()
        Description copied from interface: PromiseRef
        Promise associated with this PromiseRef.
        Specified by:
        promise in interface PromiseRef<T>
        Returns:
        (undocumented)
      • ref

        public ActorRef ref()
        Description copied from interface: PromiseRef
        ActorRef associated with this PromiseRef.
        Specified by:
        ref in interface FutureRef<T>
        Specified by:
        ref in interface PromiseRef<T>
        Returns:
        (undocumented)
      • toFutureRef

        public FutureRef<T> toFutureRef()
        Description copied from interface: PromiseRef
        Converts this PromiseRef to FutureRef, effectively narrowing it's API.
        Specified by:
        toFutureRef in interface PromiseRef<T>
        Returns:
        (undocumented)