Merge remote-tracking branch 'origin/master' into wip-1581-patterns-ask

This commit is contained in:
Roland 2012-01-18 14:20:13 +01:00
commit 1daaee98aa
141 changed files with 4660 additions and 5579 deletions

View file

@ -4,10 +4,10 @@
package akka.pattern
object Patterns {
import akka.actor.ActorRef
import akka.actor.{ ActorRef, ActorSystem }
import akka.dispatch.Future
import akka.pattern.{ ask scalaAsk }
import akka.util.Timeout
import akka.util.{ Timeout, Duration }
/**
* <i>Java API for `akka.pattern.ask`:</i>
@ -121,4 +121,18 @@ object Patterns {
* [see [[akka.dispatch.Future]] for a description of `flow`]
*/
def pipeTo[T](future: Future[T], actorRef: ActorRef): Future[T] = akka.pattern.pipeTo(future, actorRef)
/**
* Returns a [[akka.dispatch.Future]] that will be completed with success (value `true`) when
* existing messages of the target actor has been processed and the actor has been
* terminated.
*
* Useful when you need to wait for termination or compose ordered termination of several actors.
*
* If the target actor isn't terminated within the timeout the [[akka.dispatch.Future]]
* is completed with failure [[akka.actor.ActorTimeoutException]].
*/
def gracefulStop(target: ActorRef, timeout: Duration, system: ActorSystem): Future[java.lang.Boolean] = {
akka.pattern.gracefulStop(target, timeout)(system).asInstanceOf[Future[java.lang.Boolean]]
}
}