=doc #18226 document actor stopping
This commit is contained in:
parent
b25e76e95c
commit
996ad35495
4 changed files with 62 additions and 8 deletions
29
akka-docs/rst/java/code/docs/actor/MyStoppingActor.java
Normal file
29
akka-docs/rst/java/code/docs/actor/MyStoppingActor.java
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue