=doc #18226 document actor stopping

This commit is contained in:
Johan Andrén 2015-09-08 11:14:18 +02:00
parent b25e76e95c
commit 996ad35495
4 changed files with 62 additions and 8 deletions

View file

@ -0,0 +1,29 @@
/**
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
*/
package docs.actor;
//#my-stopping-actor
import akka.actor.ActorRef;
import akka.actor.UntypedActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
public class MyStoppingActor extends UntypedActor {
ActorRef child = null;
// ... creation of child ...
public void onReceive(Object message) throws Exception {
if (message.equals("interrupt-child")) {
context().stop(child);
} else if (message.equals("done")) {
context().stop(getSelf());
} else {
unhandled(message);
}
}
}
//#my-stopping-actor