add akka.Main and use that to add Hello World docs

- akka.Main will start an ActorSystem and one actor; when that actor
  terminates the system is shut down
- HelloWorld sample with two actors
This commit is contained in:
Roland 2013-04-24 22:46:39 +02:00
parent a4b485968c
commit 651f699893
11 changed files with 254 additions and 2 deletions

View file

@ -0,0 +1,26 @@
/**
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/
package docs.actor.japi;
import akka.actor.UntypedActor;
import java.io.Serializable;
//#greeter
public class Greeter extends UntypedActor {
public static enum Msg {
GREET, DONE;
}
@Override
public void onReceive(Object msg) {
if (msg == Msg.GREET) {
System.out.println("Hello World!");
getSender().tell(Msg.DONE, getSelf());
} else unhandled(msg);
}
}
//#greeter