|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GracefulStopSupport
Method Summary | |
---|---|
scala.concurrent.Future<java.lang.Object> |
gracefulStop(ActorRef target,
scala.concurrent.duration.FiniteDuration timeout,
ActorSystem system)
Returns a 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. |
Method Detail |
---|
scala.concurrent.Future<java.lang.Object> gracefulStop(ActorRef target, scala.concurrent.duration.FiniteDuration timeout, ActorSystem system)
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, which should only be done outside of the ActorSystem as blocking inside Actors is discouraged.
IMPORTANT NOTICE: the actor being terminated and its supervisor being informed of the availability of the deceased actor’s name are two distinct operations, which do not obey any reliable ordering. Especially the following will NOT work:
def receive = {
case msg =>
Await.result(gracefulStop(someChild, timeout), timeout)
context.actorOf(Props(...), "someChild") // assuming that that was someChild’s name, this will NOT work
}
If the target actor isn't terminated within the timeout the Future
is completed with failure AskTimeoutException
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |