summaryrefslogtreecommitdiff
path: root/test/files/presentation/akka/src/akka/actor/Actors.java
diff options
context:
space:
mode:
authorMicro Dotta <mirco.dotta@gmail.com>2011-08-17 13:32:25 +0000
committerMicro Dotta <mirco.dotta@gmail.com>2011-08-17 13:32:25 +0000
commit6ba1b9f3c974351e826485ca9c41df732c6de15a (patch)
tree25c08330ac9c176353cc98f6a3f6cbd0c541d07d /test/files/presentation/akka/src/akka/actor/Actors.java
parent044099d4f1677425719ea8cad8c946dab8b5c2d9 (diff)
downloadscala-6ba1b9f3c974351e826485ca9c41df732c6de15a.tar.gz
scala-6ba1b9f3c974351e826485ca9c41df732c6de15a.tar.bz2
scala-6ba1b9f3c974351e826485ca9c41df732c6de15a.zip
Major rewrite of the testing infrastructure for...
Major rewrite of the testing infrastructure for the presentation compiler. Added several new tests that will be part of the nightly build. Once the move to SBT is completed I will look into how to extract the test infrastructure (as it should really not be living in the compiler codebase). Review by dragos
Diffstat (limited to 'test/files/presentation/akka/src/akka/actor/Actors.java')
-rw-r--r--test/files/presentation/akka/src/akka/actor/Actors.java108
1 files changed, 108 insertions, 0 deletions
diff --git a/test/files/presentation/akka/src/akka/actor/Actors.java b/test/files/presentation/akka/src/akka/actor/Actors.java
new file mode 100644
index 0000000000..a5ec9f37dc
--- /dev/null
+++ b/test/files/presentation/akka/src/akka/actor/Actors.java
@@ -0,0 +1,108 @@
+package akka.actor;
+
+import akka.japi.Creator;
+import akka.remoteinterface.RemoteSupport;
+
+/**
+ * JAVA API for
+ * - creating actors,
+ * - creating remote actors,
+ * - locating actors
+ */
+public class Actors {
+ /**
+ *
+ * @return The actor registry
+ */
+ public static ActorRegistry registry() {
+ return Actor$.MODULE$.registry();
+ }
+
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException If remoting isn't configured
+ * @throws ModuleNotAvailableException If the class for the remote support cannot be loaded
+ */
+ public static RemoteSupport remote() {
+ return Actor$.MODULE$.remote();
+ }
+
+ /**
+ * NOTE: Use this convenience method with care, do NOT make it possible to get a reference to the
+ * UntypedActor instance directly, but only through its 'ActorRef' wrapper reference.
+ * <p/>
+ * Creates an ActorRef out of the Actor. Allows you to pass in the instance for the UntypedActor.
+ * Only use this method when you need to pass in constructor arguments into the 'UntypedActor'.
+ * <p/>
+ * You use it by implementing the UntypedActorFactory interface.
+ * Example in Java:
+ * <pre>
+ * ActorRef actor = Actors.actorOf(new UntypedActorFactory() {
+ * public UntypedActor create() {
+ * return new MyUntypedActor("service:name", 5);
+ * }
+ * });
+ * actor.start();
+ * actor.sendOneWay(message, context);
+ * actor.stop();
+ * </pre>
+ */
+ public static ActorRef actorOf(final Creator<Actor> factory) {
+ return Actor$.MODULE$.actorOf(factory);
+ }
+
+ /**
+ * Creates an ActorRef out of the Actor type represented by the class provided.
+ * Example in Java:
+ * <pre>
+ * ActorRef actor = Actors.actorOf(MyUntypedActor.class);
+ * actor.start();
+ * actor.sendOneWay(message, context);
+ * actor.stop();
+ * </pre>
+ * You can create and start the actor in one statement like this:
+ * <pre>
+ * val actor = Actors.actorOf(MyActor.class).start();
+ * </pre>
+ */
+ public static ActorRef actorOf(final Class<? extends Actor> type) {
+ return Actor$.MODULE$.actorOf(type);
+ }
+
+ /**
+ * The message that is sent when an Actor gets a receive timeout.
+ * <pre>
+ * if( message == receiveTimeout() ) {
+ * //Timed out
+ * }
+ * </pre>
+ * @return the single instance of ReceiveTimeout
+ */
+ public final static ReceiveTimeout$ receiveTimeout() {
+ return ReceiveTimeout$.MODULE$;
+ }
+
+ /**
+ * The message that when sent to an Actor kills it by throwing an exception.
+ * <pre>
+ * actor.sendOneWay(kill());
+ * </pre>
+ * @return the single instance of Kill
+ */
+ public final static Kill$ kill() {
+ return Kill$.MODULE$;
+ }
+
+
+ /**
+ * The message that when sent to an Actor shuts it down by calling 'stop'.
+ * <pre>
+ * actor.sendOneWay(poisonPill());
+ * </pre>
+ * @return the single instance of PoisonPill
+ */
+ public final static PoisonPill$ poisonPill() {
+ return PoisonPill$.MODULE$;
+ }
+}