diff --git a/.gitignore b/.gitignore
index d44d7ea405..7fa5190d1f 100755
--- a/.gitignore
+++ b/.gitignore
@@ -49,7 +49,8 @@ multiverse.log
.eprj
.*.swp
akka-docs/_build/
-akka-docs/epilog_rst
+akka-docs/rst_html
+akka-docs/rst_latex
*.pyc
akka-docs/exts/
_akka_cluster/
diff --git a/akka-actor-tests/src/test/java/akka/actor/JavaAPITestActor.java b/akka-actor-tests/src/test/java/akka/actor/JavaAPITestActor.java
index f8e9d1c3ee..e84f45f885 100644
--- a/akka-actor-tests/src/test/java/akka/actor/JavaAPITestActor.java
+++ b/akka-actor-tests/src/test/java/akka/actor/JavaAPITestActor.java
@@ -2,7 +2,7 @@ package akka.actor;
public class JavaAPITestActor extends UntypedActor {
public void onReceive(Object msg) {
- getSender().tell("got it!");
+ getSender().tell("got it!", getSelf());
getContext().getChildren();
}
}
diff --git a/akka-actor-tests/src/test/java/akka/actor/NonPublicClass.java b/akka-actor-tests/src/test/java/akka/actor/NonPublicClass.java
index 850d82cd62..047492e00f 100644
--- a/akka-actor-tests/src/test/java/akka/actor/NonPublicClass.java
+++ b/akka-actor-tests/src/test/java/akka/actor/NonPublicClass.java
@@ -12,6 +12,6 @@ public class NonPublicClass {
class MyNonPublicActorClass extends UntypedActor {
@Override public void onReceive(Object msg) {
- getSender().tell(msg);
+ getSender().tell(msg, getSelf());
}
}
\ No newline at end of file
diff --git a/akka-actor-tests/src/test/java/akka/actor/StashJavaAPI.java b/akka-actor-tests/src/test/java/akka/actor/StashJavaAPI.java
index 50df3d0a6b..3c17f2fe45 100644
--- a/akka-actor-tests/src/test/java/akka/actor/StashJavaAPI.java
+++ b/akka-actor-tests/src/test/java/akka/actor/StashJavaAPI.java
@@ -1,36 +1,34 @@
package akka.actor;
-import akka.actor.ActorSystem;
-import akka.japi.Creator;
-import akka.testkit.AkkaSpec;
-import com.typesafe.config.ConfigFactory;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import static org.junit.Assert.*;
+
+import com.typesafe.config.ConfigFactory;
public class StashJavaAPI {
- private static ActorSystem system;
+ private static ActorSystem system;
- @BeforeClass
- public static void beforeAll() {
- system = ActorSystem.create("StashJavaAPI", ConfigFactory.parseString(ActorWithStashSpec.testConf()));
- }
+ @BeforeClass
+ public static void beforeAll() {
+ system = ActorSystem.create("StashJavaAPI",
+ ConfigFactory.parseString(ActorWithStashSpec.testConf()));
+ }
- @AfterClass
- public static void afterAll() {
- system.shutdown();
- system = null;
- }
+ @AfterClass
+ public static void afterAll() {
+ system.shutdown();
+ system = null;
+ }
- @Test
- public void mustBeAbleToUseStash() {
- ActorRef ref = system.actorOf(new Props(StashJavaAPITestActor.class).withDispatcher("my-dispatcher"));
- ref.tell("Hello", ref);
- ref.tell("Hello", ref);
- ref.tell(new Object());
- }
+ @Test
+ public void mustBeAbleToUseStash() {
+ ActorRef ref = system.actorOf(new Props(StashJavaAPITestActor.class)
+ .withDispatcher("my-dispatcher"));
+ ref.tell("Hello", ref);
+ ref.tell("Hello", ref);
+ ref.tell(new Object(), null);
+ }
}
diff --git a/akka-actor-tests/src/test/java/akka/actor/StashJavaAPITestActor.java b/akka-actor-tests/src/test/java/akka/actor/StashJavaAPITestActor.java
index 8bc1bcc0d6..5d12f5d8e2 100644
--- a/akka-actor-tests/src/test/java/akka/actor/StashJavaAPITestActor.java
+++ b/akka-actor-tests/src/test/java/akka/actor/StashJavaAPITestActor.java
@@ -3,21 +3,22 @@ package akka.actor;
import static org.junit.Assert.*;
public class StashJavaAPITestActor extends UntypedActorWithStash {
- int count = 0;
- public void onReceive(Object msg) {
- if (msg instanceof String) {
- if (count < 0) {
- getSender().tell(new Integer(((String) msg).length()));
- } else if (count == 2) {
- count = -1;
- unstashAll();
- } else {
- count += 1;
- stash();
- }
- } else if (msg instanceof Integer) {
- int value = ((Integer) msg).intValue();
- assertEquals(value, 5);
- }
+ int count = 0;
+
+ public void onReceive(Object msg) {
+ if (msg instanceof String) {
+ if (count < 0) {
+ getSender().tell(new Integer(((String) msg).length()), getSelf());
+ } else if (count == 2) {
+ count = -1;
+ unstashAll();
+ } else {
+ count += 1;
+ stash();
+ }
+ } else if (msg instanceof Integer) {
+ int value = ((Integer) msg).intValue();
+ assertEquals(value, 5);
}
+ }
}
diff --git a/akka-actor-tests/src/test/java/akka/routing/CustomRouteTest.java b/akka-actor-tests/src/test/java/akka/routing/CustomRouteTest.java
index dc92ace228..d47c49e28d 100644
--- a/akka-actor-tests/src/test/java/akka/routing/CustomRouteTest.java
+++ b/akka-actor-tests/src/test/java/akka/routing/CustomRouteTest.java
@@ -3,14 +3,9 @@
*/
package akka.routing;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
-import akka.routing.RoundRobinRouter;
import akka.testkit.ExtractRoute;
public class CustomRouteTest {
diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala
index a95e2d84b8..ae956e968a 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala
@@ -371,8 +371,8 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
val timeout = Timeout(20000)
val ref = system.actorOf(Props(new Actor {
def receive = {
- case 5 ⇒ sender.tell("five")
- case 0 ⇒ sender.tell("null")
+ case 5 ⇒ sender ! "five"
+ case 0 ⇒ sender ! "null"
}
}))
diff --git a/akka-actor-tests/src/test/scala/akka/actor/ConsistencySpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ConsistencySpec.scala
index 8dbd9f6b4f..dbba376054 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/ConsistencySpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/ConsistencySpec.scala
@@ -32,7 +32,7 @@ object ConsistencySpec {
case step: Long ⇒
if (lastStep != (step - 1))
- sender.tell("Test failed: Last step %s, this step %s".format(lastStep, step))
+ sender ! "Test failed: Last step %s, this step %s".format(lastStep, step)
var shouldBeFortyTwo = left.value + right.value
if (shouldBeFortyTwo != 42)
diff --git a/akka-actor-tests/src/test/scala/akka/actor/Ticket669Spec.scala b/akka-actor-tests/src/test/scala/akka/actor/Ticket669Spec.scala
index e6ac2a13f3..6c96ae28a8 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/Ticket669Spec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/Ticket669Spec.scala
@@ -59,11 +59,11 @@ object Ticket669Spec {
}
override def preRestart(reason: scala.Throwable, msg: Option[Any]) {
- sender.tell("failure1")
+ sender ! "failure1"
}
override def postStop() {
- sender.tell("failure2")
+ sender ! "failure2"
}
}
}
diff --git a/akka-actor-tests/src/test/scala/akka/actor/dispatch/ActorModelSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/dispatch/ActorModelSpec.scala
index 3a3371ad51..d67acd9ac1 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/dispatch/ActorModelSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/dispatch/ActorModelSpec.scala
@@ -86,7 +86,7 @@ object ActorModelSpec {
case Wait(time) ⇒ ack; Thread.sleep(time); busy.switchOff()
case WaitAck(time, l) ⇒ ack; Thread.sleep(time); l.countDown(); busy.switchOff()
case Reply(msg) ⇒ ack; sender ! msg; busy.switchOff()
- case TryReply(msg) ⇒ ack; sender.tell(msg); busy.switchOff()
+ case TryReply(msg) ⇒ ack; sender.tell(msg, null); busy.switchOff()
case Forward(to, msg) ⇒ ack; to.forward(msg); busy.switchOff()
case CountDown(latch) ⇒ ack; latch.countDown(); busy.switchOff()
case Increment(count) ⇒ ack; count.incrementAndGet(); busy.switchOff()
diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala
index a1de1f84bd..58a785ccf3 100644
--- a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala
@@ -56,7 +56,7 @@ class PriorityDispatcherSpec extends AkkaSpec(PriorityDispatcherSpec.config) wit
def receive = {
case i: Int ⇒ acc = i :: acc
- case 'Result ⇒ sender.tell(acc)
+ case 'Result ⇒ sender ! acc
}
}).withDispatcher(dispatcherKey)).asInstanceOf[InternalActorRef]
diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
index 2d4f2245f1..b066c63ab9 100644
--- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
@@ -535,7 +535,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
case _id: Int if (_id == id) ⇒
case x ⇒ {
Thread sleep 100 * id
- sender.tell(id)
+ sender ! id
}
}
diff --git a/akka-actor/src/main/java/akka/dispatch/AbstractMessageDispatcher.java b/akka-actor/src/main/java/akka/dispatch/AbstractMessageDispatcher.java
index c701931edc..183812428e 100644
--- a/akka-actor/src/main/java/akka/dispatch/AbstractMessageDispatcher.java
+++ b/akka-actor/src/main/java/akka/dispatch/AbstractMessageDispatcher.java
@@ -6,9 +6,6 @@ package akka.dispatch;
import akka.util.Unsafe;
-import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
abstract class AbstractMessageDispatcher {
final static long shutdownScheduleOffset;
final static long inhabitantsOffset;
diff --git a/akka-actor/src/main/scala/akka/actor/ActorCell.scala b/akka-actor/src/main/scala/akka/actor/ActorCell.scala
index 2c12dae8e4..504ec5f762 100644
--- a/akka-actor/src/main/scala/akka/actor/ActorCell.scala
+++ b/akka-actor/src/main/scala/akka/actor/ActorCell.scala
@@ -504,7 +504,7 @@ private[akka] class ActorCell(
if (success) true
else {
val parent: Class[_] = clazz.getSuperclass
- if (parent eq null) throw new IllegalActorStateException(toString + " is not an Actor since it have not mixed in the 'Actor' trait")
+ if (parent eq null) throw new IllegalActorStateException(actorInstance.getClass + " is not an Actor since it have not mixed in the 'Actor' trait")
lookupAndSetField(parent, actor, name, value)
}
}
diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala
index c5e49ece70..615c4ef92e 100644
--- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala
+++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala
@@ -92,13 +92,14 @@ abstract class ActorRef extends java.lang.Comparable[ActorRef] with Serializable
* actor.tell(message);
*
*/
+ @deprecated("use the two-arg variant (typically getSelf() as second arg)", "2.1")
final def tell(msg: Any): Unit = this.!(msg)(null: ActorRef)
/**
* Java API.
* Sends the specified message to the sender, i.e. fire-and-forget
- * semantics, including the sender reference if possible (not supported on
- * all senders).
+ * semantics, including the sender reference if possible (pass `null` if
+ * there is nobody to reply to).
*
* actor.tell(message, context);
*
diff --git a/akka-actor/src/main/scala/akka/actor/RepointableActorRef.scala b/akka-actor/src/main/scala/akka/actor/RepointableActorRef.scala
index 8ca8ab5cb7..7bbc5517d8 100644
--- a/akka-actor/src/main/scala/akka/actor/RepointableActorRef.scala
+++ b/akka-actor/src/main/scala/akka/actor/RepointableActorRef.scala
@@ -195,7 +195,7 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl, val self: Rep
lock.unlock()
}
} else {
- system.deadLetters.tell(DeadLetter(message, sender, self))
+ system.deadLetters ! DeadLetter(message, sender, self)
}
}
def sendSystemMessage(msg: SystemMessage): Unit = {
@@ -209,7 +209,7 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl, val self: Rep
} else {
// FIXME: once we have guaranteed delivery of system messages, hook this in!
system.eventStream.publish(Warning(self.path.toString, getClass, "dropping system message " + msg + " due to lock timeout"))
- system.deadLetters.tell(DeadLetter(msg, self, self))
+ system.deadLetters ! DeadLetter(msg, self, self)
}
}
def isLocal = true
diff --git a/akka-actor/src/main/scala/akka/actor/dungeon/Dispatch.scala b/akka-actor/src/main/scala/akka/actor/dungeon/Dispatch.scala
index e071c1605d..1b9476acb1 100644
--- a/akka-actor/src/main/scala/akka/actor/dungeon/Dispatch.scala
+++ b/akka-actor/src/main/scala/akka/actor/dungeon/Dispatch.scala
@@ -57,7 +57,7 @@ private[akka] trait Dispatch { this: ActorCell ⇒
if (sendSupervise) {
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
parent.sendSystemMessage(akka.dispatch.Supervise(self, uid))
- parent.tell(NullMessage) // read ScalaDoc of NullMessage to see why
+ parent ! NullMessage // read ScalaDoc of NullMessage to see why
}
// This call is expected to start off the actor by scheduling its mailbox.
diff --git a/akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala b/akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala
index f7c06032c8..a42d15c6f5 100644
--- a/akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala
+++ b/akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala
@@ -194,7 +194,7 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
try if (a ne null) a.postStop()
finally try dispatcher.detach(this)
finally try parent.sendSystemMessage(ChildTerminated(self))
- finally try parent.tell(NullMessage) // read ScalaDoc of NullMessage to see why
+ finally try parent ! NullMessage // read ScalaDoc of NullMessage to see why
finally try tellWatchersWeDied(a)
finally try unwatchWatchedActors(a)
finally {
diff --git a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala
index 7e3c3ce14d..92e34a2294 100644
--- a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala
+++ b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala
@@ -75,7 +75,7 @@ trait AskSupport {
*/
def ask(actorRef: ActorRef, message: Any)(implicit timeout: Timeout): Future[Any] = actorRef match {
case ref: InternalActorRef if ref.isTerminated ⇒
- actorRef.tell(message)
+ actorRef ! message
Future.failed[Any](new AskTimeoutException("Recipient[%s] had already been terminated." format actorRef))
case ref: InternalActorRef ⇒
if (timeout.duration.length <= 0) Future.failed[Any](new IllegalArgumentException("Timeout length for an `ask` must be greater or equal to 1. Question not sent to [%s]" format actorRef))
diff --git a/akka-agent/src/main/scala/akka/agent/Agent.scala b/akka-agent/src/main/scala/akka/agent/Agent.scala
index 5b786b2599..f85fdfc4ed 100644
--- a/akka-agent/src/main/scala/akka/agent/Agent.scala
+++ b/akka-agent/src/main/scala/akka/agent/Agent.scala
@@ -9,9 +9,8 @@ import akka.japi.{ Function ⇒ JFunc, Procedure ⇒ JProc }
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.stm._
-import concurrent.{ ExecutionContext, Future, Promise, Await }
-import concurrent.util.Duration
-import scala.concurrent.util.FiniteDuration
+import scala.concurrent.{ ExecutionContext, Future, Promise, Await }
+import scala.concurrent.util.{ FiniteDuration, Duration }
/**
* Used internally to send functions.
diff --git a/akka-camel/src/test/java/akka/camel/ConsumerJavaTestBase.java b/akka-camel/src/test/java/akka/camel/ConsumerJavaTestBase.java
index e1e87f8903..466f213092 100644
--- a/akka-camel/src/test/java/akka/camel/ConsumerJavaTestBase.java
+++ b/akka-camel/src/test/java/akka/camel/ConsumerJavaTestBase.java
@@ -21,39 +21,42 @@ import akka.actor.Props;
import akka.testkit.AkkaSpec;
import akka.testkit.JavaTestKit;
-
/**
* @author Martin Krasser
*/
public class ConsumerJavaTestBase {
- static ActorSystem system = ActorSystem.create("test", AkkaSpec.testConf());
+ static ActorSystem system = ActorSystem.create("test", AkkaSpec.testConf());
- @AfterClass
- public static void tearDownAfterClass() {
- system.shutdown();
- }
+ @AfterClass
+ public static void tearDownAfterClass() {
+ system.shutdown();
+ }
- @Test
- public void shouldHandleExceptionThrownByActorAndGenerateCustomResponse() throws Exception {
- new JavaTestKit(system) {{
- String result = new EventFilter(Exception.class) {
- protected String run() {
- FiniteDuration timeout = Duration.create(1, TimeUnit.SECONDS);
- Camel camel = CamelExtension.get(system);
- ExecutionContext executionContext = system.dispatcher();
- try {
- ActorRef ref = Await.result(
- camel.activationFutureFor(system.actorOf(new Props(SampleErrorHandlingConsumer.class)), timeout, executionContext),
- timeout);
- return camel.template().requestBody("direct:error-handler-test-java", "hello", String.class);
- }
- catch (Exception e) {
- return e.getMessage();
- }
- }
- }.occurrences(1).exec();
- assertEquals("error: hello", result);
- }};
- }
+ @Test
+ public void shouldHandleExceptionThrownByActorAndGenerateCustomResponse()
+ throws Exception {
+ new JavaTestKit(system) {
+ {
+ String result = new EventFilter(Exception.class) {
+ protected String run() {
+ FiniteDuration timeout = Duration.create(1, TimeUnit.SECONDS);
+ Camel camel = CamelExtension.get(system);
+ ExecutionContext executionContext = system.dispatcher();
+ try {
+ @SuppressWarnings("unused")
+ ActorRef ref = Await.result(camel.activationFutureFor(
+ system.actorOf(new Props(SampleErrorHandlingConsumer.class)),
+ timeout, executionContext), timeout);
+ return camel.template().requestBody(
+ "direct:error-handler-test-java", "hello", String.class);
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+ }.occurrences(1).exec();
+ assertEquals("error: hello", result);
+ }
+ };
+ }
}
diff --git a/akka-camel/src/test/java/akka/camel/CustomRouteTestBase.java b/akka-camel/src/test/java/akka/camel/CustomRouteTestBase.java
index 5454dd0074..db26c9e8ab 100644
--- a/akka-camel/src/test/java/akka/camel/CustomRouteTestBase.java
+++ b/akka-camel/src/test/java/akka/camel/CustomRouteTestBase.java
@@ -208,7 +208,7 @@ public class CustomRouteTestBase {
@Override
public void onReceive(Object message) {
this.getProducerTemplate().sendBody(to, "test");
- getSender().tell(Ack.getInstance());
+ getSender().tell(Ack.getInstance(), getSelf());
}
}
}
diff --git a/akka-camel/src/test/java/akka/camel/SampleErrorHandlingConsumer.java b/akka-camel/src/test/java/akka/camel/SampleErrorHandlingConsumer.java
index f0bd9ebf3f..e5603acec1 100644
--- a/akka-camel/src/test/java/akka/camel/SampleErrorHandlingConsumer.java
+++ b/akka-camel/src/test/java/akka/camel/SampleErrorHandlingConsumer.java
@@ -42,7 +42,7 @@ public class SampleErrorHandlingConsumer extends UntypedConsumerActor {
@Override
public void preRestart(Throwable reason, Option message){
- getSender().tell(new Status.Failure(reason));
+ getSender().tell(new Status.Failure(reason), getSelf());
}
}
diff --git a/akka-camel/src/test/java/akka/camel/SampleUntypedConsumer.java b/akka-camel/src/test/java/akka/camel/SampleUntypedConsumer.java
index f52a484ccc..be293c21b9 100644
--- a/akka-camel/src/test/java/akka/camel/SampleUntypedConsumer.java
+++ b/akka-camel/src/test/java/akka/camel/SampleUntypedConsumer.java
@@ -19,7 +19,7 @@ public class SampleUntypedConsumer extends UntypedConsumerActor {
CamelMessage msg = (CamelMessage)message;
String body = msg.getBodyAs(String.class, getCamelContext());
String header = msg.getHeaderAs("test", String.class,getCamelContext());
- sender().tell(String.format("%s %s", body, header));
+ sender().tell(String.format("%s %s", body, header), getSelf());
}
}
diff --git a/akka-cluster/src/main/resources/reference.conf b/akka-cluster/src/main/resources/reference.conf
index fa6860a1a8..e2fe6cc8d1 100644
--- a/akka-cluster/src/main/resources/reference.conf
+++ b/akka-cluster/src/main/resources/reference.conf
@@ -36,9 +36,6 @@ akka {
# how often should the node send out gossip information?
gossip-interval = 1s
- # how often should the node send out heartbeats?
- heartbeat-interval = 1s
-
# how often should the leader perform maintenance tasks?
leader-actions-interval = 1s
@@ -76,6 +73,9 @@ akka {
# akka.cluster.ClusterSettings parameters
implementation-class = "akka.cluster.AccrualFailureDetector"
+ # how often should the node send out heartbeats?
+ heartbeat-interval = 1s
+
# defines the failure detector threshold
# A low threshold is prone to generate many wrong suspicions but ensures
# a quick detection in the event of a real crash. Conversely, a high
diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala
index 4212e59c1c..3c7baa4f76 100644
--- a/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala
+++ b/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala
@@ -23,6 +23,7 @@ class ClusterSettings(val config: Config, val systemName: String) {
Duration(getMilliseconds("akka.cluster.failure-detector.min-std-deviation"), MILLISECONDS)
final val FailureDetectorAcceptableHeartbeatPause: FiniteDuration =
Duration(getMilliseconds("akka.cluster.failure-detector.acceptable-heartbeat-pause"), MILLISECONDS)
+ final val HeartbeatInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.failure-detector.heartbeat-interval"), MILLISECONDS)
final val SeedNodes: IndexedSeq[Address] = getStringList("akka.cluster.seed-nodes").asScala.map {
case AddressFromURIString(addr) ⇒ addr
@@ -30,7 +31,6 @@ class ClusterSettings(val config: Config, val systemName: String) {
final val SeedNodeTimeout: FiniteDuration = Duration(getMilliseconds("akka.cluster.seed-node-timeout"), MILLISECONDS)
final val PeriodicTasksInitialDelay: FiniteDuration = Duration(getMilliseconds("akka.cluster.periodic-tasks-initial-delay"), MILLISECONDS)
final val GossipInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.gossip-interval"), MILLISECONDS)
- final val HeartbeatInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.heartbeat-interval"), MILLISECONDS)
final val LeaderActionsInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.leader-actions-interval"), MILLISECONDS)
final val UnreachableNodesReaperInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.unreachable-nodes-reaper-interval"), MILLISECONDS)
final val PublishStatsInterval: FiniteDuration = Duration(getMilliseconds("akka.cluster.publish-stats-interval"), MILLISECONDS)
diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
index f38d80ace5..68ed7d91e7 100644
--- a/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
+++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
@@ -8,7 +8,7 @@ import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import akka.actor.{ Address, ExtendedActorSystem }
import akka.remote.testconductor.RoleName
-import akka.remote.testkit.{STMultiNodeSpec, MultiNodeSpec}
+import akka.remote.testkit.{ STMultiNodeSpec, MultiNodeSpec }
import akka.testkit._
import scala.concurrent.util.duration._
import scala.concurrent.util.Duration
@@ -31,15 +31,15 @@ object MultiNodeClusterSpec {
def clusterConfig: Config = ConfigFactory.parseString("""
akka.actor.provider = akka.cluster.ClusterActorRefProvider
akka.cluster {
- auto-join = on
- auto-down = off
- jmx.enabled = off
- gossip-interval = 200 ms
- heartbeat-interval = 400 ms
- leader-actions-interval = 200 ms
- unreachable-nodes-reaper-interval = 200 ms
- periodic-tasks-initial-delay = 300 ms
- publish-stats-interval = 0 s # always, when it happens
+ auto-join = on
+ auto-down = off
+ jmx.enabled = off
+ gossip-interval = 200 ms
+ leader-actions-interval = 200 ms
+ unreachable-nodes-reaper-interval = 200 ms
+ periodic-tasks-initial-delay = 300 ms
+ publish-stats-interval = 0 s # always, when it happens
+ failure-detector.heartbeat-interval = 400 ms
}
akka.remote.log-remote-lifecycle-events = off
akka.test {
diff --git a/akka-docs/_sphinx/themes/akka/layout.html b/akka-docs/_sphinx/themes/akka/layout.html
index 5abad17ee3..426a289876 100644
--- a/akka-docs/_sphinx/themes/akka/layout.html
+++ b/akka-docs/_sphinx/themes/akka/layout.html
@@ -48,6 +48,7 @@
Documentation
+ FAQ
Download
Mailing List
Code
@@ -111,15 +112,17 @@
Company
diff --git a/akka-docs/more.png b/akka-docs/more.png
deleted file mode 100644
index 3eb7b05c84..0000000000
Binary files a/akka-docs/more.png and /dev/null differ
diff --git a/akka-docs/additional/code/osgi/Activator.scala b/akka-docs/rst/additional/code/osgi/Activator.scala
similarity index 100%
rename from akka-docs/additional/code/osgi/Activator.scala
rename to akka-docs/rst/additional/code/osgi/Activator.scala
diff --git a/akka-docs/additional/code/osgi/blueprint.xml b/akka-docs/rst/additional/code/osgi/blueprint.xml
similarity index 100%
rename from akka-docs/additional/code/osgi/blueprint.xml
rename to akka-docs/rst/additional/code/osgi/blueprint.xml
diff --git a/akka-docs/additional/index.rst b/akka-docs/rst/additional/index.rst
similarity index 100%
rename from akka-docs/additional/index.rst
rename to akka-docs/rst/additional/index.rst
diff --git a/akka-docs/additional/language-bindings.rst b/akka-docs/rst/additional/language-bindings.rst
similarity index 100%
rename from akka-docs/additional/language-bindings.rst
rename to akka-docs/rst/additional/language-bindings.rst
diff --git a/akka-docs/additional/osgi.rst b/akka-docs/rst/additional/osgi.rst
similarity index 100%
rename from akka-docs/additional/osgi.rst
rename to akka-docs/rst/additional/osgi.rst
diff --git a/akka-docs/additional/recipes.rst b/akka-docs/rst/additional/recipes.rst
similarity index 100%
rename from akka-docs/additional/recipes.rst
rename to akka-docs/rst/additional/recipes.rst
diff --git a/akka-docs/cluster/cluster-usage.rst b/akka-docs/rst/cluster/cluster-usage.rst
similarity index 79%
rename from akka-docs/cluster/cluster-usage.rst
rename to akka-docs/rst/cluster/cluster-usage.rst
index d370f8b7ac..f5948e56b7 100644
--- a/akka-docs/cluster/cluster-usage.rst
+++ b/akka-docs/rst/cluster/cluster-usage.rst
@@ -16,10 +16,12 @@ The Akka cluster is a separate jar file. Make sure that you have the following d
.. parsed-literal::
- "com.typesafe.akka" %% "akka-cluster" % "2.1-SNAPSHOT"
+ "com.typesafe.akka" %% "akka-cluster" % "@version@" @crossString@
-If you are using the latest nightly build you should pick a timestamped Akka version from ` `_. Don't use ``SNAPSHOT``. Note that the Scala version |scalaVersion|
-is part of the artifactId.
+If you are using the latest nightly build you should pick a timestamped Akka
+version from
+` `_.
+We recommend against using ``SNAPSHOT`` in order to obtain stable builds.
A Simple Cluster Example
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,7 +34,7 @@ Try it out:
1. Add the following ``application.conf`` in your project, place it in ``src/main/resources``:
-.. literalinclude:: ../../akka-samples/akka-sample-cluster/src/main/resources/application.conf
+.. literalinclude:: ../../../akka-samples/akka-sample-cluster/src/main/resources/application.conf
:language: none
To enable cluster capabilities in your Akka project you should, at a minimum, add the :ref:`remoting-scala`
@@ -47,20 +49,20 @@ ip-addresses or host names of the machines in ``application.conf`` instead of ``
2. Add the following main program to your project, place it in ``src/main/scala``:
-.. literalinclude:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/simple/SimpleClusterApp.scala
+.. literalinclude:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/simple/SimpleClusterApp.scala
:language: scala
3. Start the first seed node. Open a sbt session in one terminal window and run::
- run-main sample.cluster.simple.SimpleClusterApp 2551
+ run-main sample.cluster.simple.SimpleClusterApp 2551
2551 corresponds to the port of the first seed-nodes element in the configuration.
In the log output you see that the cluster node has been started and changed status to 'Up'.
4. Start the second seed node. Open a sbt session in another terminal window and run::
- run-main sample.cluster.simple.SimpleClusterApp 2552
+ run-main sample.cluster.simple.SimpleClusterApp 2552
2552 corresponds to the port of the second seed-nodes element in the configuration.
@@ -71,7 +73,7 @@ Switch over to the first terminal window and see in the log output that the memb
5. Start another node. Open a sbt session in yet another terminal window and run::
- run-main sample.cluster.simple.SimpleClusterApp
+ run-main sample.cluster.simple.SimpleClusterApp
Now you don't need to specify the port number, and it will use a random available port.
It joins one of the configured seed nodes. Look at the log output in the different terminal
@@ -169,15 +171,15 @@ added or removed to the cluster dynamically.
In this example the following imports are used:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#imports
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#imports
Messages:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#messages
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#messages
The backend worker that performs the transformation job:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#backend
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#backend
Note that the ``TransformationBackend`` actor subscribes to cluster events to detect new,
potential, frontend nodes, and send them a registration message so that they know
@@ -185,7 +187,7 @@ that they can use the backend worker.
The frontend that receives user jobs and delegates to one of the registered backend workers:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#frontend
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala#frontend
Note that the ``TransformationFrontend`` actor watch the registered backend
to be able to remove it from its list of availble backend workers.
@@ -214,6 +216,57 @@ frontend nodes and 3 backend nodes::
.. note:: The above example should probably be designed as two separate, frontend/backend, clusters, when there is a `cluster client for decoupling clusters `_.
+Failure Detector
+^^^^^^^^^^^^^^^^
+
+The nodes in the cluster monitor each other by sending heartbeats to detect if a node is
+unreachable from the rest of the cluster. The heartbeat arrival times is interpreted
+by an implementation of
+`The Phi Accrual Failure Detector `_.
+
+The suspicion level of failure is given by a value called *phi*.
+The basic idea of the phi failure detector is to express the value of *phi* on a scale that
+is dynamically adjusted to reflect current network conditions.
+
+The value of *phi* is calculated as::
+
+ phi = -log10(1 - F(timeSinceLastHeartbeat)
+
+where F is the cumulative distribution function of a normal distribution with mean
+and standard deviation estimated from historical heartbeat inter-arrival times.
+
+In the :ref:`cluster_configuration` you can adjust the ``akka.cluster.failure-detector.threshold``
+to define when a *phi* value is considered to be a failure.
+
+A low ``threshold`` is prone to generate many false positives but ensures
+a quick detection in the event of a real crash. Conversely, a high ``threshold``
+generates fewer mistakes but needs more time to detect actual crashes. The
+default ``threshold`` is 8 and is appropriate for most situations. However in
+cloud environments, such as Amazon EC2, the value could be increased to 12 in
+order to account for network issues that sometimes occur on such platforms.
+
+The following chart illustrates how *phi* increase with increasing time since the
+previous heartbeat.
+
+.. image:: images/phi1.png
+
+Phi is calculated from the mean and standard deviation of historical
+inter arrival times. The previous chart is an example for standard deviation
+of 200 ms. If the heartbeats arrive with less deviation the curve becomes steeper,
+i.e. it's possible to determine failure more quickly. The curve looks like this for
+a standard deviation of 100 ms.
+
+.. image:: images/phi2.png
+
+To be able to survive sudden abnormalities, such as garbage collection pauses and
+transient network failures the failure detector is configured with a margin,
+``akka.cluster.failure-detector.acceptable-heartbeat-pause``. You may want to
+adjust the :ref:`cluster_configuration` of this depending on you environment.
+This is how the curve looks like for ``acceptable-heartbeat-pause`` configured to
+3 seconds.
+
+.. image:: images/phi3.png
+
Cluster Aware Routers
^^^^^^^^^^^^^^^^^^^^^
@@ -226,7 +279,7 @@ routees are added to the router, according to the configuration.
When using a router with routees looked up on the cluster member nodes, i.e. the routees
are already running, the configuration for a router looks like this:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala#router-lookup-config
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala#router-lookup-config
It's the relative actor path defined in ``routees-path`` that identify what actor to lookup.
@@ -236,12 +289,12 @@ added to the router when nodes join the cluster.
The same type of router could also have been defined in code:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#router-lookup-in-code
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#router-lookup-in-code
When using a router with routees created and deployed on the cluster member nodes
the configuration for a router looks like this:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala#router-deploy-config
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala#router-deploy-config
``nr-of-instances`` defines total number of routees in the cluster, but the number of routees
@@ -251,7 +304,7 @@ the cluster.
The same type of router could also have been defined in code:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#router-deploy-in-code
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#router-deploy-in-code
See :ref:`cluster_configuration` section for further descriptions of the settings.
@@ -269,19 +322,19 @@ the average number of characters per word when all results have been collected.
In this example we use the following imports:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#imports
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#imports
Messages:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#messages
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#messages
The worker that counts number of characters in each word:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#worker
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#worker
The service that receives text from users and splits it up into words, delegates to workers and aggregates:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#service
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#service
Note, nothing cluster specific so far, just plain actors.
@@ -292,7 +345,7 @@ or with create and deploy of routees. Remember, routees are the workers in this
We start with the router setup with lookup of routees. All nodes start ``StatsService`` and
``StatsWorker`` actors and the router is configured with ``routees-path``:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#start-router-lookup
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#start-router-lookup
This means that user requests can be sent to ``StatsService`` on any node and it will use
``StatsWorker`` on all nodes. There can only be one worker per node, but that worker could easily
@@ -314,7 +367,7 @@ The above setup is nice for this example, but we will also take a look at how to
a single master node that creates and deploys workers. To keep track of a single
master we need one additional actor:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#facade
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#facade
The ``StatsFacade`` receives text from users and delegates to the current ``StatsService``, the single
master. It listens to cluster events to create or lookup the ``StatsService`` depending on if
@@ -324,7 +377,7 @@ i.e. it can change when new nodes join or when current leader leaves.
All nodes start ``StatsFacade`` and the router is now configured like this:
-.. includecode:: ../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#start-router-deploy
+.. includecode:: ../../../akka-samples/akka-sample-cluster/src/main/scala/sample/cluster/stats/StatsSample.scala#start-router-deploy
This example is included in ``akka-samples/akka-sample-cluster``
@@ -467,7 +520,7 @@ There are several configuration properties for the cluster. We refer to the foll
reference file for more information:
-.. literalinclude:: ../../akka-cluster/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-cluster/src/main/resources/reference.conf
:language: none
Cluster Scheduler
diff --git a/akka-docs/cluster/cluster.rst b/akka-docs/rst/cluster/cluster.rst
similarity index 100%
rename from akka-docs/cluster/cluster.rst
rename to akka-docs/rst/cluster/cluster.rst
diff --git a/akka-docs/cluster/images/member-states.png b/akka-docs/rst/cluster/images/member-states.png
similarity index 100%
rename from akka-docs/cluster/images/member-states.png
rename to akka-docs/rst/cluster/images/member-states.png
diff --git a/akka-docs/cluster/images/more.png b/akka-docs/rst/cluster/images/more.png
similarity index 100%
rename from akka-docs/cluster/images/more.png
rename to akka-docs/rst/cluster/images/more.png
diff --git a/akka-docs/rst/cluster/images/phi1.png b/akka-docs/rst/cluster/images/phi1.png
new file mode 100644
index 0000000000..104068ec54
Binary files /dev/null and b/akka-docs/rst/cluster/images/phi1.png differ
diff --git a/akka-docs/rst/cluster/images/phi2.png b/akka-docs/rst/cluster/images/phi2.png
new file mode 100644
index 0000000000..af2e756991
Binary files /dev/null and b/akka-docs/rst/cluster/images/phi2.png differ
diff --git a/akka-docs/rst/cluster/images/phi3.png b/akka-docs/rst/cluster/images/phi3.png
new file mode 100644
index 0000000000..bda3c5d345
Binary files /dev/null and b/akka-docs/rst/cluster/images/phi3.png differ
diff --git a/akka-docs/cluster/index.rst b/akka-docs/rst/cluster/index.rst
similarity index 100%
rename from akka-docs/cluster/index.rst
rename to akka-docs/rst/cluster/index.rst
diff --git a/akka-docs/common/circuitbreaker.rst b/akka-docs/rst/common/circuitbreaker.rst
similarity index 100%
rename from akka-docs/common/circuitbreaker.rst
rename to akka-docs/rst/common/circuitbreaker.rst
diff --git a/akka-docs/common/code/docs/circuitbreaker/CircuitBreakerDocSpec.scala b/akka-docs/rst/common/code/docs/circuitbreaker/CircuitBreakerDocSpec.scala
similarity index 100%
rename from akka-docs/common/code/docs/circuitbreaker/CircuitBreakerDocSpec.scala
rename to akka-docs/rst/common/code/docs/circuitbreaker/CircuitBreakerDocSpec.scala
diff --git a/akka-docs/common/code/docs/circuitbreaker/DangerousJavaActor.java b/akka-docs/rst/common/code/docs/circuitbreaker/DangerousJavaActor.java
similarity index 96%
rename from akka-docs/common/code/docs/circuitbreaker/DangerousJavaActor.java
rename to akka-docs/rst/common/code/docs/circuitbreaker/DangerousJavaActor.java
index 071affb831..ec5928a07a 100644
--- a/akka-docs/common/code/docs/circuitbreaker/DangerousJavaActor.java
+++ b/akka-docs/rst/common/code/docs/circuitbreaker/DangerousJavaActor.java
@@ -64,7 +64,7 @@ public class DangerousJavaActor extends UntypedActor {
public Future call() throws Exception {
return f;
}
- }));
+ }), getSelf());
}
if ("block for me".equals(m)) {
getSender().tell(breaker
@@ -74,7 +74,7 @@ public class DangerousJavaActor extends UntypedActor {
public String call() throws Exception {
return dangerousCall();
}
- }));
+ }), getSelf());
}
}
}
diff --git a/akka-docs/common/code/docs/duration/Java.java b/akka-docs/rst/common/code/docs/duration/Java.java
similarity index 96%
rename from akka-docs/common/code/docs/duration/Java.java
rename to akka-docs/rst/common/code/docs/duration/Java.java
index 9b7fb93c3a..06bea4d3e3 100644
--- a/akka-docs/common/code/docs/duration/Java.java
+++ b/akka-docs/rst/common/code/docs/duration/Java.java
@@ -22,5 +22,6 @@ class Java {
final Deadline deadline = Duration.create(10, "seconds").fromNow();
final Duration rest = deadline.timeLeft();
//#deadline
+ rest.toString();
}
}
diff --git a/akka-docs/common/code/docs/duration/Sample.scala b/akka-docs/rst/common/code/docs/duration/Sample.scala
similarity index 100%
rename from akka-docs/common/code/docs/duration/Sample.scala
rename to akka-docs/rst/common/code/docs/duration/Sample.scala
diff --git a/akka-docs/common/duration.rst b/akka-docs/rst/common/duration.rst
similarity index 100%
rename from akka-docs/common/duration.rst
rename to akka-docs/rst/common/duration.rst
diff --git a/akka-docs/common/index.rst b/akka-docs/rst/common/index.rst
similarity index 100%
rename from akka-docs/common/index.rst
rename to akka-docs/rst/common/index.rst
diff --git a/akka-docs/conf.py b/akka-docs/rst/conf.py
similarity index 83%
rename from akka-docs/conf.py
rename to akka-docs/rst/conf.py
index 8f58ba0d87..ae3da13292 100644
--- a/akka-docs/conf.py
+++ b/akka-docs/rst/conf.py
@@ -7,7 +7,7 @@ import sys, os
# -- General configuration -----------------------------------------------------
-sys.path.append(os.path.abspath('_sphinx/exts'))
+sys.path.append(os.path.abspath('../_sphinx/exts'))
extensions = ['sphinx.ext.todo', 'includecode']
templates_path = ['_templates']
@@ -17,29 +17,25 @@ exclude_patterns = ['_build', 'pending', 'disabled']
project = u'Akka'
copyright = u'2011, Typesafe Inc'
-version = '2.1-SNAPSHOT'
-release = '2.1-SNAPSHOT'
+version = '@version@'
+release = '@version@'
pygments_style = 'simple'
highlight_language = 'scala'
add_function_parentheses = False
show_authors = True
-f = open('epilog_rst', 'U')
-rst_epilog = "\n" + f.read()
-f.close()
-
# -- Options for HTML output ---------------------------------------------------
html_theme = 'akka'
-html_theme_path = ['_sphinx/themes']
-html_favicon = '_sphinx/static/favicon.ico'
+html_theme_path = ['../_sphinx/themes']
+html_favicon = '../_sphinx/static/favicon.ico'
html_title = 'Akka Documentation'
-html_logo = '_sphinx/static/logo.png'
+html_logo = '../_sphinx/static/logo.png'
#html_favicon = None
-html_static_path = ['_sphinx/static']
+html_static_path = ['../_sphinx/static']
html_last_updated_fmt = '%b %d, %Y'
#html_sidebars = {}
@@ -63,7 +59,7 @@ epub_language = "en"
epub_publisher = epub_author
epub_identifier = "http://doc.akka.io/docs/akka/snapshot/"
epub_scheme = "URL"
-epub_cover = ("_sphinx/static/akka.png", "")
+epub_cover = ("../_sphinx/static/akka.png", "")
# -- Options for LaTeX output --------------------------------------------------
diff --git a/akka-docs/dev/building-akka.rst b/akka-docs/rst/dev/building-akka.rst
similarity index 100%
rename from akka-docs/dev/building-akka.rst
rename to akka-docs/rst/dev/building-akka.rst
diff --git a/akka-docs/dev/developer-guidelines.rst b/akka-docs/rst/dev/developer-guidelines.rst
similarity index 100%
rename from akka-docs/dev/developer-guidelines.rst
rename to akka-docs/rst/dev/developer-guidelines.rst
diff --git a/akka-docs/dev/documentation.rst b/akka-docs/rst/dev/documentation.rst
similarity index 100%
rename from akka-docs/dev/documentation.rst
rename to akka-docs/rst/dev/documentation.rst
diff --git a/akka-docs/dev/index.rst b/akka-docs/rst/dev/index.rst
similarity index 100%
rename from akka-docs/dev/index.rst
rename to akka-docs/rst/dev/index.rst
diff --git a/akka-docs/dev/multi-jvm-testing.rst b/akka-docs/rst/dev/multi-jvm-testing.rst
similarity index 98%
rename from akka-docs/dev/multi-jvm-testing.rst
rename to akka-docs/rst/dev/multi-jvm-testing.rst
index 7658324a74..e08df5de9b 100644
--- a/akka-docs/dev/multi-jvm-testing.rst
+++ b/akka-docs/rst/dev/multi-jvm-testing.rst
@@ -49,8 +49,8 @@ multi-JVM testing (Simplified for clarity):
lazy val buildSettings = Defaults.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
organization := "com.typesafe.akka",
- version := "2.1-SNAPSHOT",
- scalaVersion := "|scalaVersion|",
+ version := "@version@",
+ scalaVersion := "@scalaVersion@",
crossPaths := false
)
diff --git a/akka-docs/dev/team.rst b/akka-docs/rst/dev/team.rst
similarity index 100%
rename from akka-docs/dev/team.rst
rename to akka-docs/rst/dev/team.rst
diff --git a/akka-docs/experimental/index.rst b/akka-docs/rst/experimental/index.rst
similarity index 100%
rename from akka-docs/experimental/index.rst
rename to akka-docs/rst/experimental/index.rst
diff --git a/akka-docs/general/ActorPath.png b/akka-docs/rst/general/ActorPath.png
similarity index 100%
rename from akka-docs/general/ActorPath.png
rename to akka-docs/rst/general/ActorPath.png
diff --git a/akka-docs/general/RemoteDeployment.png b/akka-docs/rst/general/RemoteDeployment.png
similarity index 100%
rename from akka-docs/general/RemoteDeployment.png
rename to akka-docs/rst/general/RemoteDeployment.png
diff --git a/akka-docs/general/actor-systems.rst b/akka-docs/rst/general/actor-systems.rst
similarity index 100%
rename from akka-docs/general/actor-systems.rst
rename to akka-docs/rst/general/actor-systems.rst
diff --git a/akka-docs/general/actors.rst b/akka-docs/rst/general/actors.rst
similarity index 96%
rename from akka-docs/general/actors.rst
rename to akka-docs/rst/general/actors.rst
index 0b6e5e3f77..ca940daadc 100644
--- a/akka-docs/general/actors.rst
+++ b/akka-docs/rst/general/actors.rst
@@ -131,8 +131,9 @@ When an Actor Terminates
Once an actor terminates, i.e. fails in a way which is not handled by a
restart, stops itself or is stopped by its supervisor, it will free up its
resources, draining all remaining messages from its mailbox into the system’s
-“dead letter mailbox”. The mailbox is then replaced within the actor reference
-with a system mailbox, redirecting all new messages “into the drain”. This
+“dead letter mailbox” which will forward them to the EventStream as DeadLetters.
+The mailbox is then replaced within the actor reference with a system mailbox,
+redirecting all new messages to the EventStream as DeadLetters. This
is done on a best effort basis, though, so do not rely on it in order to
construct “guaranteed delivery”.
diff --git a/akka-docs/general/addressing.rst b/akka-docs/rst/general/addressing.rst
similarity index 98%
rename from akka-docs/general/addressing.rst
rename to akka-docs/rst/general/addressing.rst
index 34c64d96cb..ecbb7ed30e 100644
--- a/akka-docs/general/addressing.rst
+++ b/akka-docs/rst/general/addressing.rst
@@ -162,13 +162,13 @@ updates for the 2.1 release.*
Creating Actors
^^^^^^^^^^^^^^^
-An actor system is typically started by creating actors above the guardian
+An actor system is typically started by creating actors beneath the guardian
actor using the :meth:`ActorSystem.actorOf` method and then using
:meth:`ActorContext.actorOf` from within the created actors to spawn the actor
tree. These methods return a reference to the newly created actor. Each actor
-has direct access to references for its parent, itself and its children. These
-references may be sent within messages to other actors, enabling those to reply
-directly.
+has direct access (through its ``ActorContext``) to references for its parent,
+itself and its children. These references may be sent within messages to other actors,
+enabling those to reply directly.
Looking up Actors by Concrete Path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/akka-docs/general/code/docs/config/ConfigDoc.java b/akka-docs/rst/general/code/docs/config/ConfigDoc.java
similarity index 100%
rename from akka-docs/general/code/docs/config/ConfigDoc.java
rename to akka-docs/rst/general/code/docs/config/ConfigDoc.java
diff --git a/akka-docs/general/code/docs/config/ConfigDocSpec.scala b/akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala
similarity index 100%
rename from akka-docs/general/code/docs/config/ConfigDocSpec.scala
rename to akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala
diff --git a/akka-docs/general/configuration.rst b/akka-docs/rst/general/configuration.rst
similarity index 95%
rename from akka-docs/general/configuration.rst
rename to akka-docs/rst/general/configuration.rst
index 78c2fee4b8..47d471863c 100644
--- a/akka-docs/general/configuration.rst
+++ b/akka-docs/rst/general/configuration.rst
@@ -142,7 +142,7 @@ before or after using them to construct an actor system:
.. parsed-literal::
- Welcome to Scala version |scalaVersion| (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
+ Welcome to Scala version @scalaVersion@ (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
@@ -337,41 +337,41 @@ Each Akka module has a reference configuration file with the default values.
akka-actor
~~~~~~~~~~
-.. literalinclude:: ../../akka-actor/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-actor/src/main/resources/reference.conf
:language: none
akka-remote
~~~~~~~~~~~
-.. literalinclude:: ../../akka-remote/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-remote/src/main/resources/reference.conf
:language: none
akka-testkit
~~~~~~~~~~~~
-.. literalinclude:: ../../akka-testkit/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-testkit/src/main/resources/reference.conf
:language: none
akka-transactor
~~~~~~~~~~~~~~~
-.. literalinclude:: ../../akka-transactor/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-transactor/src/main/resources/reference.conf
:language: none
akka-agent
~~~~~~~~~~
-.. literalinclude:: ../../akka-agent/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-agent/src/main/resources/reference.conf
:language: none
akka-zeromq
~~~~~~~~~~~
-.. literalinclude:: ../../akka-zeromq/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-zeromq/src/main/resources/reference.conf
:language: none
akka-file-mailbox
~~~~~~~~~~~~~~~~~
-.. literalinclude:: ../../akka-durable-mailboxes/akka-file-mailbox/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-durable-mailboxes/akka-file-mailbox/src/main/resources/reference.conf
:language: none
diff --git a/akka-docs/general/guardians.png b/akka-docs/rst/general/guardians.png
similarity index 100%
rename from akka-docs/general/guardians.png
rename to akka-docs/rst/general/guardians.png
diff --git a/akka-docs/general/index.rst b/akka-docs/rst/general/index.rst
similarity index 100%
rename from akka-docs/general/index.rst
rename to akka-docs/rst/general/index.rst
diff --git a/akka-docs/general/jmm.rst b/akka-docs/rst/general/jmm.rst
similarity index 100%
rename from akka-docs/general/jmm.rst
rename to akka-docs/rst/general/jmm.rst
diff --git a/akka-docs/general/message-send-semantics.rst b/akka-docs/rst/general/message-send-semantics.rst
similarity index 52%
rename from akka-docs/general/message-send-semantics.rst
rename to akka-docs/rst/general/message-send-semantics.rst
index 41eb727358..2a83c38532 100644
--- a/akka-docs/general/message-send-semantics.rst
+++ b/akka-docs/rst/general/message-send-semantics.rst
@@ -66,4 +66,51 @@ This means that:
5) ``A2`` can see messages from ``A1`` interleaved with messages from ``A3``
6) Since there is no guaranteed delivery, none, some or all of the messages may arrive to ``A2``
+.. _deadletters:
+
+Dead Letters
+============
+
+Messages which cannot be delivered (and for which this can be ascertained) will
+be delivered to a synthetic actor called ``/deadLetters``. This delivery
+happens on a best-effort basis; it may fail even within the local JVM (e.g.
+during actor termination). Messages sent via unreliable network transports will
+be lost without turning up as dead letters.
+
+How do I Receive Dead Letters?
+------------------------------
+
+An actor can subscribe to class :class:`akka.actor.DeadLetter` on the event
+stream, see :ref:`event-stream-java` (Java) or :ref:`event-stream-scala`
+(Scala) for how to do that. The subscribed actor will then receive all dead
+letters published in the (local) system from that point onwards. Dead letters
+are not propagated over the network, if you want to collect them in one place
+you will have to subscribe one actor per network node and forward them
+manually. Also consider that dead letters are generated at that node which can
+determine that a send operation is failed, which for a remote send can be the
+local system (if no network connection can be established) or the remote one
+(if the actor you are sending to does not exist at that point in time).
+
+What Should I Use Dead Letters For?
+-----------------------------------
+
+The dead letter service follows the same rules with respect to delivery
+guarantees as all other message sends, hence it cannot be used to implement
+guaranteed delivery. The main use is for debugging, especially if an actor send
+does not arrive consistently (where usually inspecting the dead letters will
+tell you that the sender or recipient was set wrong somewhere along the way).
+
+Dead Letters Which are (Usually) not Worrisome
+----------------------------------------------
+
+Every time an actor does not terminate by its own decision, there is a chance
+that some messages which it sends to itself are lost. There is one which
+happens quite easily in complex shutdown scenarios that is usually benign:
+seeing a :class:`akka.dispatch.Terminate` message dropped means that two
+termination requests were given, but of course only one can succeed. In the
+same vein, you might see :class:`akka.actor.Terminated` messages from children
+while stopping a hierarchy of actors turning up in dead letters if the parent
+is still watching the child when the parent terminates.
+
.. _Erlang documentation: http://www.erlang.org/faq/academic.html
+
diff --git a/akka-docs/general/remoting.rst b/akka-docs/rst/general/remoting.rst
similarity index 100%
rename from akka-docs/general/remoting.rst
rename to akka-docs/rst/general/remoting.rst
diff --git a/akka-docs/general/supervision.rst b/akka-docs/rst/general/supervision.rst
similarity index 89%
rename from akka-docs/general/supervision.rst
rename to akka-docs/rst/general/supervision.rst
index 88e23875a0..41cecdff0b 100644
--- a/akka-docs/general/supervision.rst
+++ b/akka-docs/rst/general/supervision.rst
@@ -49,7 +49,7 @@ recommended way in this case is to add a level of supervision.
Akka implements a specific form called “parental supervision”. Actors can only
be created by other actors—where the top-level actor is provided by the
library—and each created actor is supervised by its parent. This restriction
-makes the formation of actor supervision hierarchies explicit and encourages
+makes the formation of actor supervision hierarchies implicit and encourages
sound design decisions. It should be noted that this also guarantees that
actors cannot be orphaned or attached to supervisors from the outside, which
might otherwise catch them unawares. In addition, this yields a natural and
@@ -141,21 +141,25 @@ re-processed.
The precise sequence of events during a restart is the following:
-* suspend the actor
-* call the old instance’s :meth:`supervisionStrategy.handleSupervisorFailing`
- method (defaults to suspending all children)
-* call the old instance’s :meth:`preRestart` hook (defaults to sending
- termination requests to all children and calling :meth:`postStop`)
-* wait for all children stopped during :meth:`preRestart` to actually terminate
-* call the old instance’s :meth:`supervisionStrategy.handleSupervisorRestarted`
- method (defaults to sending restart request to all remaining children)
-* create new actor instance by invoking the originally provided factory again
-* invoke :meth:`postRestart` on the new instance
-* resume the actor
+#. suspend the actor (which means that it will not process normal messages until
+ resumed), and recursively suspend all children
+#. call the old instance’s :meth:`preRestart` hook (defaults to sending
+ termination requests to all children and calling :meth:`postStop`)
+#. wait for all children which were requested to terminate (using
+ ``context.stop()``) during :meth:`preRestart` to actually terminate
+#. create new actor instance by invoking the originally provided factory again
+#. invoke :meth:`postRestart` on the new instance (which by default also calls :meth:`preStart`)
+#. send restart request to all children (they will follow the same process
+ recursively, from step 2)
+#. resume the actor
What Lifecycle Monitoring Means
-------------------------------
+.. note::
+
+ Lifecycle Monitoring in Akka is usually referred to as ``DeathWatch``
+
In contrast to the special relationship between parent and child described
above, each actor may monitor any other actor. Since actors emerge from
creation fully alive and restarts are not visible outside of the affected
@@ -166,8 +170,10 @@ reacts to failure.
Lifecycle monitoring is implemented using a :class:`Terminated` message to be
received by the monitoring actor, where the default behavior is to throw a
-special :class:`DeathPactException` if not otherwise handled. One important
-property is that the message will be delivered irrespective of the order in
+special :class:`DeathPactException` if not otherwise handled. In order to
+start listening for :class:`Terminated` messages is to use ``ActorContext.watch(targetActorRef)``
+and then ``ActorContext.unwatch(targetActorRef)`` to stop listening for that.
+One important property is that the message will be delivered irrespective of the order in
which the monitoring request and target’s termination occur, i.e. you still get
the message even if at the time of registration the target is already dead.
diff --git a/akka-docs/images/akka-remote-testconductor.png b/akka-docs/rst/images/akka-remote-testconductor.png
similarity index 100%
rename from akka-docs/images/akka-remote-testconductor.png
rename to akka-docs/rst/images/akka-remote-testconductor.png
diff --git a/akka-docs/images/benchmark-akka-sample-trading-throughput.png b/akka-docs/rst/images/benchmark-akka-sample-trading-throughput.png
similarity index 100%
rename from akka-docs/images/benchmark-akka-sample-trading-throughput.png
rename to akka-docs/rst/images/benchmark-akka-sample-trading-throughput.png
diff --git a/akka-docs/images/build-path.png b/akka-docs/rst/images/build-path.png
similarity index 100%
rename from akka-docs/images/build-path.png
rename to akka-docs/rst/images/build-path.png
diff --git a/akka-docs/images/circuit-breaker-states.dot b/akka-docs/rst/images/circuit-breaker-states.dot
similarity index 100%
rename from akka-docs/images/circuit-breaker-states.dot
rename to akka-docs/rst/images/circuit-breaker-states.dot
diff --git a/akka-docs/images/circuit-breaker-states.png b/akka-docs/rst/images/circuit-breaker-states.png
similarity index 100%
rename from akka-docs/images/circuit-breaker-states.png
rename to akka-docs/rst/images/circuit-breaker-states.png
diff --git a/akka-docs/images/clojure-trees.png b/akka-docs/rst/images/clojure-trees.png
similarity index 100%
rename from akka-docs/images/clojure-trees.png
rename to akka-docs/rst/images/clojure-trees.png
diff --git a/akka-docs/images/diagnostics-window.png b/akka-docs/rst/images/diagnostics-window.png
similarity index 100%
rename from akka-docs/images/diagnostics-window.png
rename to akka-docs/rst/images/diagnostics-window.png
diff --git a/akka-docs/images/example-code.png b/akka-docs/rst/images/example-code.png
similarity index 100%
rename from akka-docs/images/example-code.png
rename to akka-docs/rst/images/example-code.png
diff --git a/akka-docs/images/faulttolerancesample-failure-flow.png b/akka-docs/rst/images/faulttolerancesample-failure-flow.png
similarity index 100%
rename from akka-docs/images/faulttolerancesample-failure-flow.png
rename to akka-docs/rst/images/faulttolerancesample-failure-flow.png
diff --git a/akka-docs/images/faulttolerancesample-normal-flow.png b/akka-docs/rst/images/faulttolerancesample-normal-flow.png
similarity index 100%
rename from akka-docs/images/faulttolerancesample-normal-flow.png
rename to akka-docs/rst/images/faulttolerancesample-normal-flow.png
diff --git a/akka-docs/images/faulttolerancesample.graffle b/akka-docs/rst/images/faulttolerancesample.graffle
similarity index 100%
rename from akka-docs/images/faulttolerancesample.graffle
rename to akka-docs/rst/images/faulttolerancesample.graffle
diff --git a/akka-docs/images/import-project.png b/akka-docs/rst/images/import-project.png
similarity index 100%
rename from akka-docs/images/import-project.png
rename to akka-docs/rst/images/import-project.png
diff --git a/akka-docs/images/install-beta2-updatesite.png b/akka-docs/rst/images/install-beta2-updatesite.png
similarity index 100%
rename from akka-docs/images/install-beta2-updatesite.png
rename to akka-docs/rst/images/install-beta2-updatesite.png
diff --git a/akka-docs/images/pi-formula.png b/akka-docs/rst/images/pi-formula.png
similarity index 100%
rename from akka-docs/images/pi-formula.png
rename to akka-docs/rst/images/pi-formula.png
diff --git a/akka-docs/images/quickfix.png b/akka-docs/rst/images/quickfix.png
similarity index 100%
rename from akka-docs/images/quickfix.png
rename to akka-docs/rst/images/quickfix.png
diff --git a/akka-docs/images/run-config.png b/akka-docs/rst/images/run-config.png
similarity index 100%
rename from akka-docs/images/run-config.png
rename to akka-docs/rst/images/run-config.png
diff --git a/akka-docs/index.rst b/akka-docs/rst/index.rst
similarity index 100%
rename from akka-docs/index.rst
rename to akka-docs/rst/index.rst
diff --git a/akka-docs/intro/deployment-scenarios.rst b/akka-docs/rst/intro/deployment-scenarios.rst
similarity index 100%
rename from akka-docs/intro/deployment-scenarios.rst
rename to akka-docs/rst/intro/deployment-scenarios.rst
diff --git a/akka-docs/intro/getting-started.rst b/akka-docs/rst/intro/getting-started.rst
similarity index 76%
rename from akka-docs/intro/getting-started.rst
rename to akka-docs/rst/intro/getting-started.rst
index 11b699fa8f..fdd6169abd 100644
--- a/akka-docs/intro/getting-started.rst
+++ b/akka-docs/rst/intro/getting-started.rst
@@ -29,18 +29,21 @@ Akka Maven repository.
Modules
-------
-Akka is very modular and has many JARs for containing different features.
+Akka is very modular and consists of several JARs containing different features.
-- ``akka-actor-2.1-SNAPSHOT.jar`` -- Classic Actors, Typed Actors, IO Actor etc.
-- ``akka-remote-2.1-SNAPSHOT.jar`` -- Remote Actors
-- ``akka-testkit-2.1-SNAPSHOT.jar`` -- Toolkit for testing Actor systems
-- ``akka-kernel-2.1-SNAPSHOT.jar`` -- Akka microkernel for running a bare-bones mini application server
-- ``akka-transactor-2.1-SNAPSHOT.jar`` -- Transactors - transactional actors, integrated with Scala STM
-- ``akka-agent-2.1-SNAPSHOT.jar`` -- Agents, integrated with Scala STM
-- ``akka-camel-2.1-SNAPSHOT.jar`` -- Apache Camel integration
-- ``akka-zeromq-2.1-SNAPSHOT.jar`` -- ZeroMQ integration
-- ``akka-slf4j-2.1-SNAPSHOT.jar`` -- SLF4J Event Handler Listener
-- ``akka--mailbox-2.1-SNAPSHOT.jar`` -- Akka durable mailboxes
+- ``akka-actor`` -- Classic Actors, Typed Actors, IO Actor etc.
+- ``akka-remote`` -- Remote Actors
+- ``akka-testkit`` -- Toolkit for testing Actor systems
+- ``akka-kernel`` -- Akka microkernel for running a bare-bones mini application server
+- ``akka-transactor`` -- Transactors - transactional actors, integrated with Scala STM
+- ``akka-agent`` -- Agents, integrated with Scala STM
+- ``akka-camel`` -- Apache Camel integration
+- ``akka-zeromq`` -- ZeroMQ integration
+- ``akka-slf4j`` -- SLF4J Event Handler Listener
+- ``akka-filebased-mailbox`` -- Akka durable mailbox (find more among community projects)
+
+The filename of the actual JAR is for example ``@jarName@`` (and analog for
+the other modules).
How to see the JARs dependencies of each Akka module is described in the
:ref:`dependencies` section.
@@ -84,26 +87,16 @@ The simplest way to get started with Akka and Maven is to check out the
`Akka/Maven template `_
project.
-Summary of the essential parts for using Akka with Maven:
-
-1) Add this repository to your ``pom.xml``:
-
-.. code-block:: xml
-
-
- typesafe
- Typesafe Repository
- http://repo.typesafe.com/typesafe/releases/
-
-
-2) Add the Akka dependencies. For example, here is the dependency for Akka Actor 2.1-SNAPSHOT:
+Since Akka is published to Maven Central (for versions since 2.1-M2), is it
+enough to add the Akka dependencies to the POM. For example, here is the
+dependency for akka-actor:
.. code-block:: xml
com.typesafe.akka
- akka-actor
- 2.1-SNAPSHOT
+ akka-actor_@binVersion@
+ @version@
**Note**: for snapshot versions both ``SNAPSHOT`` and timestamped versions are published.
@@ -128,11 +121,12 @@ SBT installation instructions on `https://github.com/harrah/xsbt/wiki/Setup `_.
Thanks for being a part of the Akka community.
+
diff --git a/akka-docs/intro/index.rst b/akka-docs/rst/intro/index.rst
similarity index 100%
rename from akka-docs/intro/index.rst
rename to akka-docs/rst/intro/index.rst
diff --git a/akka-docs/intro/use-cases.rst b/akka-docs/rst/intro/use-cases.rst
similarity index 100%
rename from akka-docs/intro/use-cases.rst
rename to akka-docs/rst/intro/use-cases.rst
diff --git a/akka-docs/intro/what-is-akka.rst b/akka-docs/rst/intro/what-is-akka.rst
similarity index 100%
rename from akka-docs/intro/what-is-akka.rst
rename to akka-docs/rst/intro/what-is-akka.rst
diff --git a/akka-docs/intro/why-akka.rst b/akka-docs/rst/intro/why-akka.rst
similarity index 100%
rename from akka-docs/intro/why-akka.rst
rename to akka-docs/rst/intro/why-akka.rst
diff --git a/akka-docs/java/agents.rst b/akka-docs/rst/java/agents.rst
similarity index 100%
rename from akka-docs/java/agents.rst
rename to akka-docs/rst/java/agents.rst
diff --git a/akka-docs/java/camel.rst b/akka-docs/rst/java/camel.rst
similarity index 100%
rename from akka-docs/java/camel.rst
rename to akka-docs/rst/java/camel.rst
diff --git a/akka-docs/java/code/docs/actor/FSMDocTest.scala b/akka-docs/rst/java/code/docs/actor/FSMDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/actor/FSMDocTest.scala
rename to akka-docs/rst/java/code/docs/actor/FSMDocTest.scala
diff --git a/akka-docs/java/code/docs/actor/FSMDocTestBase.java b/akka-docs/rst/java/code/docs/actor/FSMDocTestBase.java
similarity index 93%
rename from akka-docs/java/code/docs/actor/FSMDocTestBase.java
rename to akka-docs/rst/java/code/docs/actor/FSMDocTestBase.java
index 9064833cb0..5cec824bc6 100644
--- a/akka-docs/java/code/docs/actor/FSMDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/actor/FSMDocTestBase.java
@@ -147,7 +147,7 @@ public class FSMDocTestBase {
@Override
public void transition(State old, State next) {
if (old == State.ACTIVE) {
- getTarget().tell(new Batch(drainQueue()));
+ getTarget().tell(new Batch(drainQueue()), getSelf());
}
}
@@ -175,11 +175,11 @@ public class FSMDocTestBase {
public void mustBunch() {
final ActorRef buncher = system.actorOf(new Props(MyFSM.class));
final TestProbe probe = new TestProbe(system);
- buncher.tell(new SetTarget(probe.ref()));
- buncher.tell(new Queue(1));
- buncher.tell(new Queue(2));
- buncher.tell(flush);
- buncher.tell(new Queue(3));
+ buncher.tell(new SetTarget(probe.ref()), null);
+ buncher.tell(new Queue(1), null);
+ buncher.tell(new Queue(2), null);
+ buncher.tell(flush, null);
+ buncher.tell(new Queue(3), null);
final Batch b = probe.expectMsgClass(Batch.class);
assert b.objects.size() == 2;
assert b.objects.contains(1);
diff --git a/akka-docs/java/code/docs/actor/FaultHandlingTest.scala b/akka-docs/rst/java/code/docs/actor/FaultHandlingTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/actor/FaultHandlingTest.scala
rename to akka-docs/rst/java/code/docs/actor/FaultHandlingTest.scala
diff --git a/akka-docs/java/code/docs/actor/FaultHandlingTestBase.java b/akka-docs/rst/java/code/docs/actor/FaultHandlingTestBase.java
similarity index 92%
rename from akka-docs/java/code/docs/actor/FaultHandlingTestBase.java
rename to akka-docs/rst/java/code/docs/actor/FaultHandlingTestBase.java
index 6f31be6ef4..2860ed707b 100644
--- a/akka-docs/java/code/docs/actor/FaultHandlingTestBase.java
+++ b/akka-docs/rst/java/code/docs/actor/FaultHandlingTestBase.java
@@ -64,7 +64,7 @@ public class FaultHandlingTestBase {
public void onReceive(Object o) {
if (o instanceof Props) {
- getSender().tell(getContext().actorOf((Props) o));
+ getSender().tell(getContext().actorOf((Props) o), getSelf());
} else {
unhandled(o);
}
@@ -102,7 +102,7 @@ public class FaultHandlingTestBase {
public void onReceive(Object o) {
if (o instanceof Props) {
- getSender().tell(getContext().actorOf((Props) o));
+ getSender().tell(getContext().actorOf((Props) o), getSelf());
} else {
unhandled(o);
}
@@ -126,7 +126,7 @@ public class FaultHandlingTestBase {
} else if (o instanceof Integer) {
state = (Integer) o;
} else if (o.equals("get")) {
- getSender().tell(state);
+ getSender().tell(state, getSelf());
} else {
unhandled(o);
}
@@ -167,21 +167,21 @@ public class FaultHandlingTestBase {
//#create
//#resume
- child.tell(42);
+ child.tell(42, null);
assert Await.result(ask(child, "get", 5000), timeout).equals(42);
- child.tell(new ArithmeticException());
+ child.tell(new ArithmeticException(), null);
assert Await.result(ask(child, "get", 5000), timeout).equals(42);
//#resume
//#restart
- child.tell(new NullPointerException());
+ child.tell(new NullPointerException(), null);
assert Await.result(ask(child, "get", 5000), timeout).equals(0);
//#restart
//#stop
final TestProbe probe = new TestProbe(system);
probe.watch(child);
- child.tell(new IllegalArgumentException());
+ child.tell(new IllegalArgumentException(), null);
probe.expectMsgClass(Terminated.class);
//#stop
@@ -189,7 +189,7 @@ public class FaultHandlingTestBase {
child = (ActorRef) Await.result(ask(supervisor, new Props(Child.class), 5000), timeout);
probe.watch(child);
assert Await.result(ask(child, "get", 5000), timeout).equals(0);
- child.tell(new Exception());
+ child.tell(new Exception(), null);
probe.expectMsgClass(Terminated.class);
//#escalate-kill
@@ -197,9 +197,9 @@ public class FaultHandlingTestBase {
superprops = new Props(Supervisor2.class);
supervisor = system.actorOf(superprops);
child = (ActorRef) Await.result(ask(supervisor, new Props(Child.class), 5000), timeout);
- child.tell(23);
+ child.tell(23, null);
assert Await.result(ask(child, "get", 5000), timeout).equals(23);
- child.tell(new Exception());
+ child.tell(new Exception(), null);
assert Await.result(ask(child, "get", 5000), timeout).equals(0);
//#escalate-restart
//#testkit
diff --git a/akka-docs/java/code/docs/actor/FirstUntypedActor.java b/akka-docs/rst/java/code/docs/actor/FirstUntypedActor.java
similarity index 90%
rename from akka-docs/java/code/docs/actor/FirstUntypedActor.java
rename to akka-docs/rst/java/code/docs/actor/FirstUntypedActor.java
index fa5d3d35a0..a4aea8c1cd 100644
--- a/akka-docs/java/code/docs/actor/FirstUntypedActor.java
+++ b/akka-docs/rst/java/code/docs/actor/FirstUntypedActor.java
@@ -16,6 +16,6 @@ public class FirstUntypedActor extends UntypedActor {
public void onReceive(Object message) {
myActor.forward(message, getContext());
- myActor.tell(PoisonPill.getInstance());
+ myActor.tell(PoisonPill.getInstance(), null);
}
}
diff --git a/akka-docs/java/code/docs/actor/ImmutableMessage.java b/akka-docs/rst/java/code/docs/actor/ImmutableMessage.java
similarity index 100%
rename from akka-docs/java/code/docs/actor/ImmutableMessage.java
rename to akka-docs/rst/java/code/docs/actor/ImmutableMessage.java
diff --git a/akka-docs/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java b/akka-docs/rst/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java
similarity index 92%
rename from akka-docs/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java
rename to akka-docs/rst/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java
index 3f24e9cb1f..b1fb899be7 100644
--- a/akka-docs/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java
+++ b/akka-docs/rst/java/code/docs/actor/MyReceivedTimeoutUntypedActor.java
@@ -16,7 +16,7 @@ public class MyReceivedTimeoutUntypedActor extends UntypedActor {
public void onReceive(Object message) {
if (message.equals("Hello")) {
- getSender().tell("Hello world");
+ getSender().tell("Hello world", getSelf());
} else if (message == ReceiveTimeout.getInstance()) {
throw new RuntimeException("received timeout");
} else {
diff --git a/akka-docs/java/code/docs/actor/MyUntypedActor.java b/akka-docs/rst/java/code/docs/actor/MyUntypedActor.java
similarity index 100%
rename from akka-docs/java/code/docs/actor/MyUntypedActor.java
rename to akka-docs/rst/java/code/docs/actor/MyUntypedActor.java
diff --git a/akka-docs/java/code/docs/actor/SchedulerDocTest.scala b/akka-docs/rst/java/code/docs/actor/SchedulerDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/actor/SchedulerDocTest.scala
rename to akka-docs/rst/java/code/docs/actor/SchedulerDocTest.scala
diff --git a/akka-docs/java/code/docs/actor/SchedulerDocTestBase.java b/akka-docs/rst/java/code/docs/actor/SchedulerDocTestBase.java
similarity index 96%
rename from akka-docs/java/code/docs/actor/SchedulerDocTestBase.java
rename to akka-docs/rst/java/code/docs/actor/SchedulerDocTestBase.java
index a5837ac85c..96aa0bcf1e 100644
--- a/akka-docs/java/code/docs/actor/SchedulerDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/actor/SchedulerDocTestBase.java
@@ -24,7 +24,6 @@ import akka.testkit.AkkaSpec;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.*;
public class SchedulerDocTestBase {
@@ -54,7 +53,7 @@ public class SchedulerDocTestBase {
system.scheduler().scheduleOnce(Duration.create(50, TimeUnit.MILLISECONDS), new Runnable() {
@Override
public void run() {
- testActor.tell(System.currentTimeMillis());
+ testActor.tell(System.currentTimeMillis(), null);
}
}, system.dispatcher());
//#schedule-one-off-thunk
diff --git a/akka-docs/java/code/docs/actor/TypedActorDocTest.scala b/akka-docs/rst/java/code/docs/actor/TypedActorDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/actor/TypedActorDocTest.scala
rename to akka-docs/rst/java/code/docs/actor/TypedActorDocTest.scala
diff --git a/akka-docs/java/code/docs/actor/TypedActorDocTestBase.java b/akka-docs/rst/java/code/docs/actor/TypedActorDocTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/actor/TypedActorDocTestBase.java
rename to akka-docs/rst/java/code/docs/actor/TypedActorDocTestBase.java
diff --git a/akka-docs/java/code/docs/actor/UntypedActorDocTest.scala b/akka-docs/rst/java/code/docs/actor/UntypedActorDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/actor/UntypedActorDocTest.scala
rename to akka-docs/rst/java/code/docs/actor/UntypedActorDocTest.scala
diff --git a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java b/akka-docs/rst/java/code/docs/actor/UntypedActorDocTestBase.java
similarity index 93%
rename from akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java
rename to akka-docs/rst/java/code/docs/actor/UntypedActorDocTestBase.java
index 2b335dee99..e79d73ec1d 100644
--- a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/actor/UntypedActorDocTestBase.java
@@ -54,21 +54,15 @@ import java.util.ArrayList;
import akka.actor.UntypedActorWithStash;
//#import-stash
-import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.actor.UntypedActorFactory;
-import akka.dispatch.MessageDispatcher;
import org.junit.Test;
import scala.Option;
import java.lang.Object;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.concurrent.TimeUnit;
import akka.pattern.Patterns;
-import static org.junit.Assert.*;
-
public class UntypedActorDocTestBase {
@Test
@@ -95,7 +89,7 @@ public class UntypedActorDocTestBase {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class), "myactor");
//#system-actorOf
- myActor.tell("test");
+ myActor.tell("test", null);
system.shutdown();
}
@@ -105,7 +99,7 @@ public class UntypedActorDocTestBase {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class), "myactor");
//#context-actorOf
- myActor.tell("test");
+ myActor.tell("test", null);
system.shutdown();
}
@@ -120,7 +114,7 @@ public class UntypedActorDocTestBase {
}
}), "myactor");
//#creating-constructor
- myActor.tell("test");
+ myActor.tell("test", null);
system.shutdown();
}
@@ -130,7 +124,7 @@ public class UntypedActorDocTestBase {
//#creating-props
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class).withDispatcher("my-dispatcher"), "myactor");
//#creating-props
- myActor.tell("test");
+ myActor.tell("test", null);
system.shutdown();
}
@@ -154,7 +148,7 @@ public class UntypedActorDocTestBase {
public void receiveTimeout() {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(MyReceivedTimeoutUntypedActor.class));
- myActor.tell("Hello");
+ myActor.tell("Hello", null);
system.shutdown();
}
@@ -163,7 +157,7 @@ public class UntypedActorDocTestBase {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class));
//#poison-pill
- myActor.tell(PoisonPill.getInstance());
+ myActor.tell(PoisonPill.getInstance(), null);
//#poison-pill
system.shutdown();
}
@@ -173,7 +167,7 @@ public class UntypedActorDocTestBase {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef victim = system.actorOf(new Props(MyUntypedActor.class));
//#kill
- victim.tell(Kill.getInstance());
+ victim.tell(Kill.getInstance(), null);
//#kill
system.shutdown();
}
@@ -186,9 +180,9 @@ public class UntypedActorDocTestBase {
return new HotSwapActor();
}
}));
- myActor.tell("foo");
- myActor.tell("bar");
- myActor.tell("bar");
+ myActor.tell("foo", null);
+ myActor.tell("bar", null);
+ myActor.tell("bar", null);
system.shutdown();
}
@@ -265,7 +259,7 @@ public class UntypedActorDocTestBase {
try {
operation();
} catch (Exception e) {
- getSender().tell(new akka.actor.Status.Failure(e));
+ getSender().tell(new akka.actor.Status.Failure(e), getSelf());
throw e;
}
}
@@ -298,9 +292,9 @@ public class UntypedActorDocTestBase {
//#reply-exception
try {
String result = operation();
- getSender().tell(result);
+ getSender().tell(result, getSelf());
} catch (Exception e) {
- getSender().tell(new akka.actor.Status.Failure(e));
+ getSender().tell(new akka.actor.Status.Failure(e), getSelf());
throw e;
}
//#reply-exception
@@ -318,7 +312,7 @@ public class UntypedActorDocTestBase {
@Override
public void apply(Object message) {
if (message.equals("bar")) {
- getSender().tell("I am already angry?");
+ getSender().tell("I am already angry?", getSelf());
} else if (message.equals("foo")) {
getContext().become(happy);
}
@@ -329,7 +323,7 @@ public class UntypedActorDocTestBase {
@Override
public void apply(Object message) {
if (message.equals("bar")) {
- getSender().tell("I am already happy :-)");
+ getSender().tell("I am already happy :-)", getSelf());
} else if (message.equals("foo")) {
getContext().become(angry);
}
@@ -390,7 +384,7 @@ public class UntypedActorDocTestBase {
} else if (message instanceof Terminated) {
final Terminated t = (Terminated) message;
if (t.getActor() == child) {
- lastSender.tell("finished");
+ lastSender.tell("finished", getSelf());
}
} else {
unhandled(message);
diff --git a/akka-docs/java/code/docs/actor/UntypedActorSwapper.java b/akka-docs/rst/java/code/docs/actor/UntypedActorSwapper.java
similarity index 84%
rename from akka-docs/java/code/docs/actor/UntypedActorSwapper.java
rename to akka-docs/rst/java/code/docs/actor/UntypedActorSwapper.java
index 985c75bfd7..c882ac015a 100644
--- a/akka-docs/java/code/docs/actor/UntypedActorSwapper.java
+++ b/akka-docs/rst/java/code/docs/actor/UntypedActorSwapper.java
@@ -44,12 +44,12 @@ public class UntypedActorSwapper {
public static void main(String... args) {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef swap = system.actorOf(new Props(Swapper.class));
- swap.tell(SWAP); // logs Hi
- swap.tell(SWAP); // logs Ho
- swap.tell(SWAP); // logs Hi
- swap.tell(SWAP); // logs Ho
- swap.tell(SWAP); // logs Hi
- swap.tell(SWAP); // logs Ho
+ swap.tell(SWAP, null); // logs Hi
+ swap.tell(SWAP, null); // logs Ho
+ swap.tell(SWAP, null); // logs Hi
+ swap.tell(SWAP, null); // logs Ho
+ swap.tell(SWAP, null); // logs Hi
+ swap.tell(SWAP, null); // logs Ho
}
}
diff --git a/akka-docs/java/code/docs/actor/japi/FaultHandlingDocSample.java b/akka-docs/rst/java/code/docs/actor/japi/FaultHandlingDocSample.java
similarity index 100%
rename from akka-docs/java/code/docs/actor/japi/FaultHandlingDocSample.java
rename to akka-docs/rst/java/code/docs/actor/japi/FaultHandlingDocSample.java
diff --git a/akka-docs/java/code/docs/agent/AgentDocJavaSpec.scala b/akka-docs/rst/java/code/docs/agent/AgentDocJavaSpec.scala
similarity index 100%
rename from akka-docs/java/code/docs/agent/AgentDocJavaSpec.scala
rename to akka-docs/rst/java/code/docs/agent/AgentDocJavaSpec.scala
diff --git a/akka-docs/java/code/docs/agent/AgentDocTest.java b/akka-docs/rst/java/code/docs/agent/AgentDocTest.java
similarity index 100%
rename from akka-docs/java/code/docs/agent/AgentDocTest.java
rename to akka-docs/rst/java/code/docs/agent/AgentDocTest.java
diff --git a/akka-docs/java/code/docs/camel/ActivationTestBase.java b/akka-docs/rst/java/code/docs/camel/ActivationTestBase.java
similarity index 97%
rename from akka-docs/java/code/docs/camel/ActivationTestBase.java
rename to akka-docs/rst/java/code/docs/camel/ActivationTestBase.java
index d75b59b02b..e0b9b60c2b 100644
--- a/akka-docs/java/code/docs/camel/ActivationTestBase.java
+++ b/akka-docs/rst/java/code/docs/camel/ActivationTestBase.java
@@ -14,8 +14,6 @@ package docs.camel;
import org.junit.Test;
-import java.util.concurrent.TimeUnit;
-
public class ActivationTestBase {
@Test
diff --git a/akka-docs/java/code/docs/camel/CamelExtensionDocTest.scala b/akka-docs/rst/java/code/docs/camel/CamelExtensionDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/camel/CamelExtensionDocTest.scala
rename to akka-docs/rst/java/code/docs/camel/CamelExtensionDocTest.scala
diff --git a/akka-docs/java/code/docs/camel/CamelExtensionTestBase.java b/akka-docs/rst/java/code/docs/camel/CamelExtensionTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/CamelExtensionTestBase.java
rename to akka-docs/rst/java/code/docs/camel/CamelExtensionTestBase.java
diff --git a/akka-docs/java/code/docs/camel/Consumer1.java b/akka-docs/rst/java/code/docs/camel/Consumer1.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/Consumer1.java
rename to akka-docs/rst/java/code/docs/camel/Consumer1.java
diff --git a/akka-docs/java/code/docs/camel/Consumer2.java b/akka-docs/rst/java/code/docs/camel/Consumer2.java
similarity index 97%
rename from akka-docs/java/code/docs/camel/Consumer2.java
rename to akka-docs/rst/java/code/docs/camel/Consumer2.java
index b22c324877..7f1836a9e1 100644
--- a/akka-docs/java/code/docs/camel/Consumer2.java
+++ b/akka-docs/rst/java/code/docs/camel/Consumer2.java
@@ -12,7 +12,7 @@ public class Consumer2 extends UntypedConsumerActor {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
String body = camelMessage.getBodyAs(String.class, getCamelContext());
- getSender().tell(String.format("Received message: %s",body));
+ getSender().tell(String.format("Received message: %s",body), getSelf());
} else
unhandled(message);
}
diff --git a/akka-docs/java/code/docs/camel/Consumer3.java b/akka-docs/rst/java/code/docs/camel/Consumer3.java
similarity index 82%
rename from akka-docs/java/code/docs/camel/Consumer3.java
rename to akka-docs/rst/java/code/docs/camel/Consumer3.java
index bf661cb8ea..95c24f2f82 100644
--- a/akka-docs/java/code/docs/camel/Consumer3.java
+++ b/akka-docs/rst/java/code/docs/camel/Consumer3.java
@@ -18,12 +18,12 @@ public class Consumer3 extends UntypedConsumerActor{
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
- getSender().tell(Ack.getInstance());
+ getSender().tell(Ack.getInstance(), getSelf());
// on success
// ..
Exception someException = new Exception("e1");
// on failure
- getSender().tell(new Status.Failure(someException));
+ getSender().tell(new Status.Failure(someException), getSelf());
} else
unhandled(message);
}
diff --git a/akka-docs/java/code/docs/camel/Consumer4.java b/akka-docs/rst/java/code/docs/camel/Consumer4.java
similarity index 92%
rename from akka-docs/java/code/docs/camel/Consumer4.java
rename to akka-docs/rst/java/code/docs/camel/Consumer4.java
index 144d79965b..960b523f3a 100644
--- a/akka-docs/java/code/docs/camel/Consumer4.java
+++ b/akka-docs/rst/java/code/docs/camel/Consumer4.java
@@ -23,7 +23,7 @@ public class Consumer4 extends UntypedConsumerActor {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
String body = camelMessage.getBodyAs(String.class, getCamelContext());
- getSender().tell(String.format("Hello %s",body));
+ getSender().tell(String.format("Hello %s",body), getSelf());
} else
unhandled(message);
}
diff --git a/akka-docs/java/code/docs/camel/CustomRouteBuilder.java b/akka-docs/rst/java/code/docs/camel/CustomRouteBuilder.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/CustomRouteBuilder.java
rename to akka-docs/rst/java/code/docs/camel/CustomRouteBuilder.java
diff --git a/akka-docs/java/code/docs/camel/CustomRouteTestBase.java b/akka-docs/rst/java/code/docs/camel/CustomRouteTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/CustomRouteTestBase.java
rename to akka-docs/rst/java/code/docs/camel/CustomRouteTestBase.java
diff --git a/akka-docs/java/code/docs/camel/ErrorThrowingConsumer.java b/akka-docs/rst/java/code/docs/camel/ErrorThrowingConsumer.java
similarity index 95%
rename from akka-docs/java/code/docs/camel/ErrorThrowingConsumer.java
rename to akka-docs/rst/java/code/docs/camel/ErrorThrowingConsumer.java
index 23790021be..9a01717287 100644
--- a/akka-docs/java/code/docs/camel/ErrorThrowingConsumer.java
+++ b/akka-docs/rst/java/code/docs/camel/ErrorThrowingConsumer.java
@@ -36,7 +36,7 @@ public class ErrorThrowingConsumer extends UntypedConsumerActor{
@Override
public void preRestart(Throwable reason, Option message) {
- getSender().tell(new Status.Failure(reason));
+ getSender().tell(new Status.Failure(reason), getSelf());
}
}
//#ErrorThrowingConsumer
\ No newline at end of file
diff --git a/akka-docs/java/code/docs/camel/FirstProducer.java b/akka-docs/rst/java/code/docs/camel/FirstProducer.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/FirstProducer.java
rename to akka-docs/rst/java/code/docs/camel/FirstProducer.java
diff --git a/akka-docs/java/code/docs/camel/Forwarder.java b/akka-docs/rst/java/code/docs/camel/Forwarder.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/Forwarder.java
rename to akka-docs/rst/java/code/docs/camel/Forwarder.java
diff --git a/akka-docs/java/code/docs/camel/MyActor.java b/akka-docs/rst/java/code/docs/camel/MyActor.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/MyActor.java
rename to akka-docs/rst/java/code/docs/camel/MyActor.java
diff --git a/akka-docs/java/code/docs/camel/MyEndpoint.java b/akka-docs/rst/java/code/docs/camel/MyEndpoint.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/MyEndpoint.java
rename to akka-docs/rst/java/code/docs/camel/MyEndpoint.java
diff --git a/akka-docs/java/code/docs/camel/OnRouteResponseTestBase.java b/akka-docs/rst/java/code/docs/camel/OnRouteResponseTestBase.java
similarity index 92%
rename from akka-docs/java/code/docs/camel/OnRouteResponseTestBase.java
rename to akka-docs/rst/java/code/docs/camel/OnRouteResponseTestBase.java
index 7bcb9e16db..54248c8cfd 100644
--- a/akka-docs/java/code/docs/camel/OnRouteResponseTestBase.java
+++ b/akka-docs/rst/java/code/docs/camel/OnRouteResponseTestBase.java
@@ -1,7 +1,6 @@
package docs.camel;
import akka.actor.*;
-import org.junit.Test;
public class OnRouteResponseTestBase {
@@ -18,7 +17,7 @@ public class OnRouteResponseTestBase {
ActorRef forwardResponse = system.actorOf(new Props(factory));
// the Forwarder sends out a request to the web page and forwards the response to
// the ResponseReceiver
- forwardResponse.tell("some request");
+ forwardResponse.tell("some request", null);
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);
diff --git a/akka-docs/java/code/docs/camel/OnewaySender.java b/akka-docs/rst/java/code/docs/camel/OnewaySender.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/OnewaySender.java
rename to akka-docs/rst/java/code/docs/camel/OnewaySender.java
diff --git a/akka-docs/java/code/docs/camel/Orders.java b/akka-docs/rst/java/code/docs/camel/Orders.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/Orders.java
rename to akka-docs/rst/java/code/docs/camel/Orders.java
diff --git a/akka-docs/java/code/docs/camel/Producer1.java b/akka-docs/rst/java/code/docs/camel/Producer1.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/Producer1.java
rename to akka-docs/rst/java/code/docs/camel/Producer1.java
diff --git a/akka-docs/java/code/docs/camel/ProducerTestBase.java b/akka-docs/rst/java/code/docs/camel/ProducerTestBase.java
similarity index 78%
rename from akka-docs/java/code/docs/camel/ProducerTestBase.java
rename to akka-docs/rst/java/code/docs/camel/ProducerTestBase.java
index 2cab47d02c..e2954e06f8 100644
--- a/akka-docs/java/code/docs/camel/ProducerTestBase.java
+++ b/akka-docs/rst/java/code/docs/camel/ProducerTestBase.java
@@ -1,20 +1,14 @@
package docs.camel;
-import akka.actor.*;
-import akka.camel.Camel;
-import akka.camel.CamelExtension;
-import akka.camel.CamelMessage;
-import akka.pattern.Patterns;
-import scala.concurrent.Future;
-import scala.concurrent.util.Duration;
-import scala.concurrent.util.FiniteDuration;
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.junit.Test;
-
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
+
+import scala.concurrent.Future;
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import akka.camel.CamelMessage;
+import akka.pattern.Patterns;
public class ProducerTestBase {
public void tellJmsProducer() {
@@ -22,7 +16,7 @@ public class ProducerTestBase {
ActorSystem system = ActorSystem.create("some-system");
Props props = new Props(Orders.class);
ActorRef producer = system.actorOf(props, "jmsproducer");
- producer.tell("");
+ producer.tell("", null);
//#TellProducer
system.shutdown();
}
@@ -45,7 +39,7 @@ public class ProducerTestBase {
ActorRef producer = system.actorOf(props,"jmsproducer");
Map headers = new HashMap();
headers.put(CamelMessage.MessageExchangeId(),"123");
- producer.tell(new CamelMessage("",headers));
+ producer.tell(new CamelMessage("",headers), null);
//#Correlate
system.stop(producer);
system.shutdown();
diff --git a/akka-docs/java/code/docs/camel/RequestBodyActor.java b/akka-docs/rst/java/code/docs/camel/RequestBodyActor.java
similarity index 96%
rename from akka-docs/java/code/docs/camel/RequestBodyActor.java
rename to akka-docs/rst/java/code/docs/camel/RequestBodyActor.java
index 009b0f380f..dfa5599069 100644
--- a/akka-docs/java/code/docs/camel/RequestBodyActor.java
+++ b/akka-docs/rst/java/code/docs/camel/RequestBodyActor.java
@@ -9,7 +9,7 @@ public class RequestBodyActor extends UntypedActor {
public void onReceive(Object message) {
Camel camel = CamelExtension.get(getContext().system());
ProducerTemplate template = camel.template();
- getSender().tell(template.requestBody("direct:news", message));
+ getSender().tell(template.requestBody("direct:news", message), getSelf());
}
}
//#RequestProducerTemplate
\ No newline at end of file
diff --git a/akka-docs/java/code/docs/camel/Responder.java b/akka-docs/rst/java/code/docs/camel/Responder.java
similarity index 90%
rename from akka-docs/java/code/docs/camel/Responder.java
rename to akka-docs/rst/java/code/docs/camel/Responder.java
index 304ed4bb5d..12ca8603cf 100644
--- a/akka-docs/java/code/docs/camel/Responder.java
+++ b/akka-docs/rst/java/code/docs/camel/Responder.java
@@ -9,7 +9,7 @@ public class Responder extends UntypedActor{
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
- getSender().tell(createResponse(camelMessage));
+ getSender().tell(createResponse(camelMessage), getSelf());
} else
unhandled(message);
}
diff --git a/akka-docs/java/code/docs/camel/ResponseReceiver.java b/akka-docs/rst/java/code/docs/camel/ResponseReceiver.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/ResponseReceiver.java
rename to akka-docs/rst/java/code/docs/camel/ResponseReceiver.java
diff --git a/akka-docs/java/code/docs/camel/Transformer.java b/akka-docs/rst/java/code/docs/camel/Transformer.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/Transformer.java
rename to akka-docs/rst/java/code/docs/camel/Transformer.java
diff --git a/akka-docs/java/code/docs/camel/sample/http/HttpConsumer.java b/akka-docs/rst/java/code/docs/camel/sample/http/HttpConsumer.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/http/HttpConsumer.java
rename to akka-docs/rst/java/code/docs/camel/sample/http/HttpConsumer.java
diff --git a/akka-docs/java/code/docs/camel/sample/http/HttpProducer.java b/akka-docs/rst/java/code/docs/camel/sample/http/HttpProducer.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/http/HttpProducer.java
rename to akka-docs/rst/java/code/docs/camel/sample/http/HttpProducer.java
diff --git a/akka-docs/java/code/docs/camel/sample/http/HttpSample.java b/akka-docs/rst/java/code/docs/camel/sample/http/HttpSample.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/http/HttpSample.java
rename to akka-docs/rst/java/code/docs/camel/sample/http/HttpSample.java
diff --git a/akka-docs/java/code/docs/camel/sample/http/HttpTransformer.java b/akka-docs/rst/java/code/docs/camel/sample/http/HttpTransformer.java
similarity index 88%
rename from akka-docs/java/code/docs/camel/sample/http/HttpTransformer.java
rename to akka-docs/rst/java/code/docs/camel/sample/http/HttpTransformer.java
index 36a620379f..267d828cd7 100644
--- a/akka-docs/java/code/docs/camel/sample/http/HttpTransformer.java
+++ b/akka-docs/rst/java/code/docs/camel/sample/http/HttpTransformer.java
@@ -16,9 +16,9 @@ public class HttpTransformer extends UntypedActor{
return text.replaceAll("Akka ", "AKKA ");
}
});
- getSender().tell(replacedMessage);
+ getSender().tell(replacedMessage, getSelf());
} else if (message instanceof Status.Failure) {
- getSender().tell(message);
+ getSender().tell(message, getSelf());
} else
unhandled(message);
}
diff --git a/akka-docs/java/code/docs/camel/sample/quartz/MyQuartzActor.java b/akka-docs/rst/java/code/docs/camel/sample/quartz/MyQuartzActor.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/quartz/MyQuartzActor.java
rename to akka-docs/rst/java/code/docs/camel/sample/quartz/MyQuartzActor.java
diff --git a/akka-docs/java/code/docs/camel/sample/quartz/QuartzSample.java b/akka-docs/rst/java/code/docs/camel/sample/quartz/QuartzSample.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/quartz/QuartzSample.java
rename to akka-docs/rst/java/code/docs/camel/sample/quartz/QuartzSample.java
diff --git a/akka-docs/java/code/docs/camel/sample/route/Consumer3.java b/akka-docs/rst/java/code/docs/camel/sample/route/Consumer3.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/route/Consumer3.java
rename to akka-docs/rst/java/code/docs/camel/sample/route/Consumer3.java
diff --git a/akka-docs/java/code/docs/camel/sample/route/CustomRouteBuilder.java b/akka-docs/rst/java/code/docs/camel/sample/route/CustomRouteBuilder.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/route/CustomRouteBuilder.java
rename to akka-docs/rst/java/code/docs/camel/sample/route/CustomRouteBuilder.java
diff --git a/akka-docs/java/code/docs/camel/sample/route/CustomRouteSample.java b/akka-docs/rst/java/code/docs/camel/sample/route/CustomRouteSample.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/route/CustomRouteSample.java
rename to akka-docs/rst/java/code/docs/camel/sample/route/CustomRouteSample.java
diff --git a/akka-docs/java/code/docs/camel/sample/route/Producer1.java b/akka-docs/rst/java/code/docs/camel/sample/route/Producer1.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/route/Producer1.java
rename to akka-docs/rst/java/code/docs/camel/sample/route/Producer1.java
diff --git a/akka-docs/java/code/docs/camel/sample/route/Transformer.java b/akka-docs/rst/java/code/docs/camel/sample/route/Transformer.java
similarity index 100%
rename from akka-docs/java/code/docs/camel/sample/route/Transformer.java
rename to akka-docs/rst/java/code/docs/camel/sample/route/Transformer.java
diff --git a/akka-docs/java/code/docs/dispatcher/DispatcherDocTest.scala b/akka-docs/rst/java/code/docs/dispatcher/DispatcherDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/dispatcher/DispatcherDocTest.scala
rename to akka-docs/rst/java/code/docs/dispatcher/DispatcherDocTest.scala
diff --git a/akka-docs/java/code/docs/dispatcher/DispatcherDocTestBase.java b/akka-docs/rst/java/code/docs/dispatcher/DispatcherDocTestBase.java
similarity index 91%
rename from akka-docs/java/code/docs/dispatcher/DispatcherDocTestBase.java
rename to akka-docs/rst/java/code/docs/dispatcher/DispatcherDocTestBase.java
index ca5569657e..c3fbd03d14 100644
--- a/akka-docs/java/code/docs/dispatcher/DispatcherDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/dispatcher/DispatcherDocTestBase.java
@@ -37,12 +37,10 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import scala.Option;
-import static org.junit.Assert.*;
import com.typesafe.config.ConfigFactory;
import docs.actor.MyUntypedActor;
-import docs.actor.UntypedActorDocTestBase.MyActor;
import akka.testkit.AkkaSpec;
public class DispatcherDocTestBase {
@@ -89,14 +87,14 @@ public class DispatcherDocTestBase {
LoggingAdapter log =
Logging.getLogger(getContext().system(), this);
{
- getSelf().tell("lowpriority");
- getSelf().tell("lowpriority");
- getSelf().tell("highpriority");
- getSelf().tell("pigdog");
- getSelf().tell("pigdog2");
- getSelf().tell("pigdog3");
- getSelf().tell("highpriority");
- getSelf().tell(PoisonPill.getInstance());
+ getSelf().tell("lowpriority", getSelf());
+ getSelf().tell("lowpriority", getSelf());
+ getSelf().tell("highpriority", getSelf());
+ getSelf().tell("pigdog", getSelf());
+ getSelf().tell("pigdog2", getSelf());
+ getSelf().tell("pigdog3", getSelf());
+ getSelf().tell("highpriority", getSelf());
+ getSelf().tell(PoisonPill.getInstance(), getSelf());
}
public void onReceive(Object message) {
diff --git a/akka-docs/java/code/docs/event/LoggingDocTest.scala b/akka-docs/rst/java/code/docs/event/LoggingDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/event/LoggingDocTest.scala
rename to akka-docs/rst/java/code/docs/event/LoggingDocTest.scala
diff --git a/akka-docs/java/code/docs/event/LoggingDocTestBase.java b/akka-docs/rst/java/code/docs/event/LoggingDocTestBase.java
similarity index 96%
rename from akka-docs/java/code/docs/event/LoggingDocTestBase.java
rename to akka-docs/rst/java/code/docs/event/LoggingDocTestBase.java
index 77e46b3f92..d19915708e 100644
--- a/akka-docs/java/code/docs/event/LoggingDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/event/LoggingDocTestBase.java
@@ -21,7 +21,6 @@ import akka.event.Logging.Debug;
import org.junit.Test;
import scala.Option;
-import static org.junit.Assert.*;
import akka.actor.UntypedActorFactory;
//#imports-deadletter
@@ -42,7 +41,7 @@ public class LoggingDocTestBase {
return new MyActor();
}
}));
- myActor.tell("test");
+ myActor.tell("test", null);
system.shutdown();
}
@@ -96,7 +95,7 @@ public class LoggingDocTestBase {
class MyEventListener extends UntypedActor {
public void onReceive(Object message) {
if (message instanceof InitializeLogger) {
- getSender().tell(Logging.loggerInitialized());
+ getSender().tell(Logging.loggerInitialized(), getSelf());
} else if (message instanceof Error) {
// ...
} else if (message instanceof Warning) {
diff --git a/akka-docs/java/code/docs/extension/ExtensionDocTest.scala b/akka-docs/rst/java/code/docs/extension/ExtensionDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/extension/ExtensionDocTest.scala
rename to akka-docs/rst/java/code/docs/extension/ExtensionDocTest.scala
diff --git a/akka-docs/java/code/docs/extension/ExtensionDocTestBase.java b/akka-docs/rst/java/code/docs/extension/ExtensionDocTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/extension/ExtensionDocTestBase.java
rename to akka-docs/rst/java/code/docs/extension/ExtensionDocTestBase.java
diff --git a/akka-docs/java/code/docs/extension/SettingsExtensionDocTest.scala b/akka-docs/rst/java/code/docs/extension/SettingsExtensionDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/extension/SettingsExtensionDocTest.scala
rename to akka-docs/rst/java/code/docs/extension/SettingsExtensionDocTest.scala
diff --git a/akka-docs/java/code/docs/extension/SettingsExtensionDocTestBase.java b/akka-docs/rst/java/code/docs/extension/SettingsExtensionDocTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/extension/SettingsExtensionDocTestBase.java
rename to akka-docs/rst/java/code/docs/extension/SettingsExtensionDocTestBase.java
diff --git a/akka-docs/java/code/docs/future/FutureDocTest.scala b/akka-docs/rst/java/code/docs/future/FutureDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/future/FutureDocTest.scala
rename to akka-docs/rst/java/code/docs/future/FutureDocTest.scala
diff --git a/akka-docs/java/code/docs/future/FutureDocTestBase.java b/akka-docs/rst/java/code/docs/future/FutureDocTestBase.java
similarity index 98%
rename from akka-docs/java/code/docs/future/FutureDocTestBase.java
rename to akka-docs/rst/java/code/docs/future/FutureDocTestBase.java
index ca23065661..74dc3a6e28 100644
--- a/akka-docs/java/code/docs/future/FutureDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/future/FutureDocTestBase.java
@@ -534,13 +534,13 @@ public class FutureDocTestBase {
public static class MyActor extends UntypedActor {
public void onReceive(Object message) {
if (message instanceof String) {
- getSender().tell(((String) message).toUpperCase());
+ getSender().tell(((String) message).toUpperCase(), getSelf());
} else if (message instanceof Integer) {
int i = ((Integer) message).intValue();
if (i < 0) {
- getSender().tell(new Failure(new ArithmeticException("Negative values not supported")));
+ getSender().tell(new Failure(new ArithmeticException("Negative values not supported")), getSelf());
} else {
- getSender().tell(i);
+ getSender().tell(i, getSelf());
}
} else {
unhandled(message);
diff --git a/akka-docs/java/code/docs/jrouting/ConsistentHashingRouterDocTest.scala b/akka-docs/rst/java/code/docs/jrouting/ConsistentHashingRouterDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/jrouting/ConsistentHashingRouterDocTest.scala
rename to akka-docs/rst/java/code/docs/jrouting/ConsistentHashingRouterDocTest.scala
diff --git a/akka-docs/java/code/docs/jrouting/ConsistentHashingRouterDocTestBase.java b/akka-docs/rst/java/code/docs/jrouting/ConsistentHashingRouterDocTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/jrouting/ConsistentHashingRouterDocTestBase.java
rename to akka-docs/rst/java/code/docs/jrouting/ConsistentHashingRouterDocTestBase.java
diff --git a/akka-docs/java/code/docs/jrouting/CustomRouterDocTest.scala b/akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/jrouting/CustomRouterDocTest.scala
rename to akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTest.scala
diff --git a/akka-docs/java/code/docs/jrouting/CustomRouterDocTestBase.java b/akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTestBase.java
similarity index 83%
rename from akka-docs/java/code/docs/jrouting/CustomRouterDocTestBase.java
rename to akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTestBase.java
index d47419ee60..5918c07d12 100644
--- a/akka-docs/java/code/docs/jrouting/CustomRouterDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTestBase.java
@@ -3,28 +3,37 @@
*/
package docs.jrouting;
-import java.util.List;
+import static akka.pattern.Patterns.ask;
+import static docs.jrouting.CustomRouterDocTestBase.Message.DemocratCountResult;
+import static docs.jrouting.CustomRouterDocTestBase.Message.DemocratVote;
+import static docs.jrouting.CustomRouterDocTestBase.Message.RepublicanCountResult;
+import static docs.jrouting.CustomRouterDocTestBase.Message.RepublicanVote;
+import static org.junit.Assert.assertEquals;
+
import java.util.Arrays;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import akka.actor.*;
-import akka.routing.*;
-import scala.concurrent.util.Duration;
-import akka.util.Timeout;
import scala.concurrent.Await;
import scala.concurrent.Future;
+import scala.concurrent.util.Duration;
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.OneForOneStrategy;
+import akka.actor.Props;
+import akka.actor.SupervisorStrategy;
+import akka.actor.UntypedActor;
import akka.dispatch.Dispatchers;
+import akka.routing.CustomRoute;
+import akka.routing.CustomRouterConfig;
+import akka.routing.Destination;
+import akka.routing.RoundRobinRouter;
+import akka.routing.RouteeProvider;
import akka.testkit.AkkaSpec;
-import com.typesafe.config.ConfigFactory;
-import static akka.pattern.Patterns.ask;
-
-import static docs.jrouting.CustomRouterDocTestBase.DemocratActor;
-import static docs.jrouting.CustomRouterDocTestBase.RepublicanActor;
-import static docs.jrouting.CustomRouterDocTestBase.Message.*;
+import akka.util.Timeout;
public class CustomRouterDocTestBase {
@@ -67,11 +76,11 @@ public class CustomRouterDocTestBase {
@Test
public void countVotesAsIntendedNotAsInFlorida() throws Exception {
ActorRef routedActor = system.actorOf(new Props().withRouter(new VoteCountRouter()));
- routedActor.tell(DemocratVote);
- routedActor.tell(DemocratVote);
- routedActor.tell(RepublicanVote);
- routedActor.tell(DemocratVote);
- routedActor.tell(RepublicanVote);
+ routedActor.tell(DemocratVote, null);
+ routedActor.tell(DemocratVote, null);
+ routedActor.tell(RepublicanVote, null);
+ routedActor.tell(DemocratVote, null);
+ routedActor.tell(RepublicanVote, null);
Timeout timeout = new Timeout(Duration.create(1, "seconds"));
Future democratsResult = ask(routedActor, DemocratCountResult, timeout);
Future republicansResult = ask(routedActor, RepublicanCountResult, timeout);
diff --git a/akka-docs/java/code/docs/jrouting/FibonacciActor.java b/akka-docs/rst/java/code/docs/jrouting/FibonacciActor.java
similarity index 92%
rename from akka-docs/java/code/docs/jrouting/FibonacciActor.java
rename to akka-docs/rst/java/code/docs/jrouting/FibonacciActor.java
index e316f27bce..7c084849b7 100644
--- a/akka-docs/java/code/docs/jrouting/FibonacciActor.java
+++ b/akka-docs/rst/java/code/docs/jrouting/FibonacciActor.java
@@ -12,7 +12,7 @@ public class FibonacciActor extends UntypedActor {
public void onReceive(Object msg) {
if (msg instanceof FibonacciNumber) {
FibonacciNumber fibonacciNumber = (FibonacciNumber) msg;
- getSender().tell(fibonacci(fibonacciNumber.getNbr()));
+ getSender().tell(fibonacci(fibonacciNumber.getNbr()), getSelf());
} else {
unhandled(msg);
}
diff --git a/akka-docs/java/code/docs/jrouting/ParentActor.java b/akka-docs/rst/java/code/docs/jrouting/ParentActor.java
similarity index 100%
rename from akka-docs/java/code/docs/jrouting/ParentActor.java
rename to akka-docs/rst/java/code/docs/jrouting/ParentActor.java
diff --git a/akka-docs/java/code/docs/jrouting/PrintlnActor.java b/akka-docs/rst/java/code/docs/jrouting/PrintlnActor.java
similarity index 100%
rename from akka-docs/java/code/docs/jrouting/PrintlnActor.java
rename to akka-docs/rst/java/code/docs/jrouting/PrintlnActor.java
diff --git a/akka-docs/java/code/docs/jrouting/RouterViaConfigExample.java b/akka-docs/rst/java/code/docs/jrouting/RouterViaConfigExample.java
similarity index 93%
rename from akka-docs/java/code/docs/jrouting/RouterViaConfigExample.java
rename to akka-docs/rst/java/code/docs/jrouting/RouterViaConfigExample.java
index 1505766196..4a89948c88 100644
--- a/akka-docs/java/code/docs/jrouting/RouterViaConfigExample.java
+++ b/akka-docs/rst/java/code/docs/jrouting/RouterViaConfigExample.java
@@ -45,14 +45,14 @@ public class RouterViaConfigExample {
ActorRef router = system.actorOf(new Props(ExampleActor.class).withRouter(new FromConfig()), "router");
//#configurableRouting
for (int i = 1; i <= 10; i++) {
- router.tell(new ExampleActor.Message(i));
+ router.tell(new ExampleActor.Message(i), null);
}
//#configurableRoutingWithResizer
ActorRef router2 = system.actorOf(new Props(ExampleActor.class).withRouter(new FromConfig()), "router2");
//#configurableRoutingWithResizer
for (int i = 1; i <= 10; i++) {
- router2.tell(new ExampleActor.Message(i));
+ router2.tell(new ExampleActor.Message(i), null);
}
}
}
\ No newline at end of file
diff --git a/akka-docs/java/code/docs/jrouting/RouterViaProgramExample.java b/akka-docs/rst/java/code/docs/jrouting/RouterViaProgramExample.java
similarity index 94%
rename from akka-docs/java/code/docs/jrouting/RouterViaProgramExample.java
rename to akka-docs/rst/java/code/docs/jrouting/RouterViaProgramExample.java
index 99b924d09b..b403a98915 100644
--- a/akka-docs/java/code/docs/jrouting/RouterViaProgramExample.java
+++ b/akka-docs/rst/java/code/docs/jrouting/RouterViaProgramExample.java
@@ -47,7 +47,7 @@ public class RouterViaProgramExample {
ActorRef router1 = system.actorOf(new Props(ExampleActor.class).withRouter(new RoundRobinRouter(nrOfInstances)));
//#programmaticRoutingNrOfInstances
for (int i = 1; i <= 6; i++) {
- router1.tell(new ExampleActor.Message(i));
+ router1.tell(new ExampleActor.Message(i), null);
}
//#programmaticRoutingRoutees
@@ -58,7 +58,7 @@ public class RouterViaProgramExample {
ActorRef router2 = system.actorOf(new Props().withRouter(RoundRobinRouter.create(routees)));
//#programmaticRoutingRoutees
for (int i = 1; i <= 6; i++) {
- router2.tell(new ExampleActor.Message(i));
+ router2.tell(new ExampleActor.Message(i), null);
}
//#programmaticRoutingWithResizer
@@ -68,7 +68,7 @@ public class RouterViaProgramExample {
ActorRef router3 = system.actorOf(new Props(ExampleActor.class).withRouter(new RoundRobinRouter(nrOfInstances)));
//#programmaticRoutingWithResizer
for (int i = 1; i <= 6; i++) {
- router3.tell(new ExampleActor.Message(i));
+ router3.tell(new ExampleActor.Message(i), null);
}
//#remoteRoutees
diff --git a/akka-docs/java/code/docs/pattern/JavaTemplate.java b/akka-docs/rst/java/code/docs/pattern/JavaTemplate.java
similarity index 100%
rename from akka-docs/java/code/docs/pattern/JavaTemplate.java
rename to akka-docs/rst/java/code/docs/pattern/JavaTemplate.java
diff --git a/akka-docs/java/code/docs/remoting/RemoteActorExample.java b/akka-docs/rst/java/code/docs/remoting/RemoteActorExample.java
similarity index 100%
rename from akka-docs/java/code/docs/remoting/RemoteActorExample.java
rename to akka-docs/rst/java/code/docs/remoting/RemoteActorExample.java
diff --git a/akka-docs/java/code/docs/remoting/RemoteDeploymentDocTest.scala b/akka-docs/rst/java/code/docs/remoting/RemoteDeploymentDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/remoting/RemoteDeploymentDocTest.scala
rename to akka-docs/rst/java/code/docs/remoting/RemoteDeploymentDocTest.scala
diff --git a/akka-docs/java/code/docs/remoting/RemoteDeploymentDocTestBase.java b/akka-docs/rst/java/code/docs/remoting/RemoteDeploymentDocTestBase.java
similarity index 100%
rename from akka-docs/java/code/docs/remoting/RemoteDeploymentDocTestBase.java
rename to akka-docs/rst/java/code/docs/remoting/RemoteDeploymentDocTestBase.java
diff --git a/akka-docs/java/code/docs/serialization/SerializationDocTest.scala b/akka-docs/rst/java/code/docs/serialization/SerializationDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/serialization/SerializationDocTest.scala
rename to akka-docs/rst/java/code/docs/serialization/SerializationDocTest.scala
diff --git a/akka-docs/java/code/docs/serialization/SerializationDocTestBase.java b/akka-docs/rst/java/code/docs/serialization/SerializationDocTestBase.java
similarity index 99%
rename from akka-docs/java/code/docs/serialization/SerializationDocTestBase.java
rename to akka-docs/rst/java/code/docs/serialization/SerializationDocTestBase.java
index e30385e1d0..da111f7fbb 100644
--- a/akka-docs/java/code/docs/serialization/SerializationDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/serialization/SerializationDocTestBase.java
@@ -9,7 +9,6 @@ import static org.junit.Assert.*;
import akka.actor.*;
import akka.remote.RemoteActorRefProvider;
import akka.serialization.*;
-import com.typesafe.config.*;
//#imports
diff --git a/akka-docs/java/code/docs/testkit/TestKitDocTest.java b/akka-docs/rst/java/code/docs/testkit/TestKitDocTest.java
similarity index 94%
rename from akka-docs/java/code/docs/testkit/TestKitDocTest.java
rename to akka-docs/rst/java/code/docs/testkit/TestKitDocTest.java
index f0c2263c3e..14a51f9957 100644
--- a/akka-docs/java/code/docs/testkit/TestKitDocTest.java
+++ b/akka-docs/rst/java/code/docs/testkit/TestKitDocTest.java
@@ -97,7 +97,7 @@ public class TestKitDocTest {
public void demonstrateWithin() {
//#test-within
new JavaTestKit(system) {{
- getRef().tell(42);
+ getRef().tell(42, null);
new Within(Duration.Zero(), Duration.create(1, "second")) {
// do not put code outside this method, will run afterwards
public void run() {
@@ -112,7 +112,7 @@ public class TestKitDocTest {
public void demonstrateExpectMsg() {
//#test-expectmsg
new JavaTestKit(system) {{
- getRef().tell(42);
+ getRef().tell(42, null);
final String out = new ExpectMsg("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
@@ -132,9 +132,9 @@ public class TestKitDocTest {
public void demonstrateReceiveWhile() {
//#test-receivewhile
new JavaTestKit(system) {{
- getRef().tell(42);
- getRef().tell(43);
- getRef().tell("hello");
+ getRef().tell(42, null);
+ getRef().tell(43, null);
+ getRef().tell("hello", null);
final String[] out =
new ReceiveWhile(String.class, duration("1 second")) {
// do not put code outside this method, will run afterwards
@@ -172,7 +172,7 @@ public class TestKitDocTest {
public void demonstrateAwaitCond() {
//#test-awaitCond
new JavaTestKit(system) {{
- getRef().tell(42);
+ getRef().tell(42, null);
new AwaitCond(
duration("1 second"), // maximum wait time
duration("100 millis") // interval at which to check the condition
@@ -191,12 +191,12 @@ public class TestKitDocTest {
@SuppressWarnings("unchecked") // due to generic varargs
public void demonstrateExpect() {
new JavaTestKit(system) {{
- getRef().tell("hello");
- getRef().tell("hello");
- getRef().tell("hello");
- getRef().tell("world");
- getRef().tell(42);
- getRef().tell(42);
+ getRef().tell("hello", null);
+ getRef().tell("hello", null);
+ getRef().tell("hello", null);
+ getRef().tell("world", null);
+ getRef().tell(42, null);
+ getRef().tell(42, null);
//#test-expect
final String hello = expectMsgEquals("hello");
final Object any = expectMsgAnyOf("hello", "world");
@@ -223,12 +223,12 @@ public class TestKitDocTest {
return msg instanceof String;
}
};
- getRef().tell("hello");
- getRef().tell(42);
+ getRef().tell("hello", null);
+ getRef().tell(42, null);
expectMsgEquals(42);
// remove message filter
ignoreNoMsg();
- getRef().tell("hello");
+ getRef().tell("hello", null);
expectMsgEquals("hello");
}};
//#test-ignoreMsg
@@ -294,7 +294,7 @@ public class TestKitDocTest {
}
final MyProbe probe = new MyProbe();
- probe.getRef().tell("hello");
+ probe.getRef().tell("hello", null);
probe.assertHello();
}};
//#test-special-probe
@@ -354,7 +354,7 @@ public class TestKitDocTest {
// install auto-pilot
probe.setAutoPilot(new TestActor.AutoPilot() {
public AutoPilot run(ActorRef sender, Object msg) {
- sender.tell(msg);
+ sender.tell(msg, null);
return noAutoPilot();
}
});
@@ -386,7 +386,7 @@ public class TestKitDocTest {
final int result = new EventFilter(ActorKilledException.class) {
protected Integer run() {
- victim.tell(Kill.getInstance());
+ victim.tell(Kill.getInstance(), null);
return 42;
}
}.from("akka://demoSystem/user/victim").occurrences(1).exec();
diff --git a/akka-docs/java/code/docs/testkit/TestKitSampleTest.java b/akka-docs/rst/java/code/docs/testkit/TestKitSampleTest.java
similarity index 96%
rename from akka-docs/java/code/docs/testkit/TestKitSampleTest.java
rename to akka-docs/rst/java/code/docs/testkit/TestKitSampleTest.java
index e09daae2fd..b86cc366da 100644
--- a/akka-docs/java/code/docs/testkit/TestKitSampleTest.java
+++ b/akka-docs/rst/java/code/docs/testkit/TestKitSampleTest.java
@@ -24,12 +24,12 @@ public class TestKitSampleTest {
public void onReceive(Object msg) {
if (msg.equals("hello")) {
- getSender().tell("world");
+ getSender().tell("world", getSelf());
if (target != null) target.forward(msg, getContext());
} else if (msg instanceof ActorRef) {
target = (ActorRef) msg;
- getSender().tell("done");
+ getSender().tell("done", getSelf());
}
}
}
diff --git a/akka-docs/java/code/docs/transactor/CoordinatedCounter.java b/akka-docs/rst/java/code/docs/transactor/CoordinatedCounter.java
similarity index 92%
rename from akka-docs/java/code/docs/transactor/CoordinatedCounter.java
rename to akka-docs/rst/java/code/docs/transactor/CoordinatedCounter.java
index 4bd679f1eb..8461fd7bf5 100644
--- a/akka-docs/java/code/docs/transactor/CoordinatedCounter.java
+++ b/akka-docs/rst/java/code/docs/transactor/CoordinatedCounter.java
@@ -20,7 +20,7 @@ public class CoordinatedCounter extends UntypedActor {
if (message instanceof Increment) {
Increment increment = (Increment) message;
if (increment.hasFriend()) {
- increment.getFriend().tell(coordinated.coordinate(new Increment()));
+ increment.getFriend().tell(coordinated.coordinate(new Increment()), getSelf());
}
coordinated.atomic(new Runnable() {
public void run() {
@@ -29,7 +29,7 @@ public class CoordinatedCounter extends UntypedActor {
});
}
} else if ("GetCount".equals(incoming)) {
- getSender().tell(count.get());
+ getSender().tell(count.get(), getSelf());
} else {
unhandled(incoming);
}
diff --git a/akka-docs/java/code/docs/transactor/Coordinator.java b/akka-docs/rst/java/code/docs/transactor/Coordinator.java
similarity index 100%
rename from akka-docs/java/code/docs/transactor/Coordinator.java
rename to akka-docs/rst/java/code/docs/transactor/Coordinator.java
diff --git a/akka-docs/java/code/docs/transactor/Counter.java b/akka-docs/rst/java/code/docs/transactor/Counter.java
similarity index 91%
rename from akka-docs/java/code/docs/transactor/Counter.java
rename to akka-docs/rst/java/code/docs/transactor/Counter.java
index 06092c5db0..c72151e916 100644
--- a/akka-docs/java/code/docs/transactor/Counter.java
+++ b/akka-docs/rst/java/code/docs/transactor/Counter.java
@@ -20,7 +20,7 @@ public class Counter extends UntypedTransactor {
@Override public boolean normally(Object message) {
if ("GetCount".equals(message)) {
- getSender().tell(count.get());
+ getSender().tell(count.get(), getSelf());
return true;
} else return false;
}
diff --git a/akka-docs/java/code/docs/transactor/FriendlyCounter.java b/akka-docs/rst/java/code/docs/transactor/FriendlyCounter.java
similarity index 93%
rename from akka-docs/java/code/docs/transactor/FriendlyCounter.java
rename to akka-docs/rst/java/code/docs/transactor/FriendlyCounter.java
index f24c044750..3dc4df9cb7 100644
--- a/akka-docs/java/code/docs/transactor/FriendlyCounter.java
+++ b/akka-docs/rst/java/code/docs/transactor/FriendlyCounter.java
@@ -5,7 +5,6 @@
package docs.transactor;
//#class
-import akka.actor.*;
import akka.transactor.*;
import java.util.Set;
import scala.concurrent.stm.Ref;
@@ -31,7 +30,7 @@ public class FriendlyCounter extends UntypedTransactor {
@Override public boolean normally(Object message) {
if ("GetCount".equals(message)) {
- getSender().tell(count.get());
+ getSender().tell(count.get(), getSelf());
return true;
} else return false;
}
diff --git a/akka-docs/java/code/docs/transactor/Increment.java b/akka-docs/rst/java/code/docs/transactor/Increment.java
similarity index 100%
rename from akka-docs/java/code/docs/transactor/Increment.java
rename to akka-docs/rst/java/code/docs/transactor/Increment.java
diff --git a/akka-docs/java/code/docs/transactor/Message.java b/akka-docs/rst/java/code/docs/transactor/Message.java
similarity index 100%
rename from akka-docs/java/code/docs/transactor/Message.java
rename to akka-docs/rst/java/code/docs/transactor/Message.java
diff --git a/akka-docs/java/code/docs/transactor/TransactorDocJavaSpec.scala b/akka-docs/rst/java/code/docs/transactor/TransactorDocJavaSpec.scala
similarity index 100%
rename from akka-docs/java/code/docs/transactor/TransactorDocJavaSpec.scala
rename to akka-docs/rst/java/code/docs/transactor/TransactorDocJavaSpec.scala
diff --git a/akka-docs/java/code/docs/transactor/TransactorDocTest.java b/akka-docs/rst/java/code/docs/transactor/TransactorDocTest.java
similarity index 92%
rename from akka-docs/java/code/docs/transactor/TransactorDocTest.java
rename to akka-docs/rst/java/code/docs/transactor/TransactorDocTest.java
index f0b15da925..a8b44c9c97 100644
--- a/akka-docs/java/code/docs/transactor/TransactorDocTest.java
+++ b/akka-docs/rst/java/code/docs/transactor/TransactorDocTest.java
@@ -12,7 +12,6 @@ import akka.actor.*;
import scala.concurrent.Await;
import static akka.pattern.Patterns.ask;
import akka.transactor.Coordinated;
-import scala.concurrent.util.Duration;
import akka.util.Timeout;
import static java.util.concurrent.TimeUnit.SECONDS;
//#imports
@@ -29,7 +28,7 @@ public class TransactorDocTest {
Timeout timeout = new Timeout(5, SECONDS);
- counter1.tell(new Coordinated(new Increment(counter2), timeout));
+ counter1.tell(new Coordinated(new Increment(counter2), timeout), null);
Integer count = (Integer) Await.result(ask(counter1, "GetCount", timeout), timeout.duration());
//#coordinated-example
@@ -50,11 +49,11 @@ public class TransactorDocTest {
ActorRef actor = system.actorOf(new Props(Coordinator.class));
//#send-coordinated
- actor.tell(new Coordinated(new Message(), timeout));
+ actor.tell(new Coordinated(new Message(), timeout), null);
//#send-coordinated
//#include-coordinated
- actor.tell(coordinated.coordinate(new Message()));
+ actor.tell(coordinated.coordinate(new Message()), null);
//#include-coordinated
coordinated.await();
@@ -69,7 +68,7 @@ public class TransactorDocTest {
Timeout timeout = new Timeout(5, SECONDS);
Coordinated coordinated = new Coordinated(timeout);
- counter.tell(coordinated.coordinate(new Increment()));
+ counter.tell(coordinated.coordinate(new Increment()), null);
coordinated.await();
Integer count = (Integer) Await.result(ask(counter, "GetCount", timeout), timeout.duration());
@@ -86,7 +85,7 @@ public class TransactorDocTest {
Timeout timeout = new Timeout(5, SECONDS);
Coordinated coordinated = new Coordinated(timeout);
- friendlyCounter.tell(coordinated.coordinate(new Increment(friend)));
+ friendlyCounter.tell(coordinated.coordinate(new Increment(friend)), null);
coordinated.await();
Integer count1 = (Integer) Await.result(ask(friendlyCounter, "GetCount", timeout), timeout.duration());
diff --git a/akka-docs/java/code/docs/zeromq/ZeromqDocTest.scala b/akka-docs/rst/java/code/docs/zeromq/ZeromqDocTest.scala
similarity index 100%
rename from akka-docs/java/code/docs/zeromq/ZeromqDocTest.scala
rename to akka-docs/rst/java/code/docs/zeromq/ZeromqDocTest.scala
diff --git a/akka-docs/java/code/docs/zeromq/ZeromqDocTestBase.java b/akka-docs/rst/java/code/docs/zeromq/ZeromqDocTestBase.java
similarity index 97%
rename from akka-docs/java/code/docs/zeromq/ZeromqDocTestBase.java
rename to akka-docs/rst/java/code/docs/zeromq/ZeromqDocTestBase.java
index c392cf131f..1980011f9e 100644
--- a/akka-docs/java/code/docs/zeromq/ZeromqDocTestBase.java
+++ b/akka-docs/rst/java/code/docs/zeromq/ZeromqDocTestBase.java
@@ -46,7 +46,6 @@ import com.typesafe.config.ConfigFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.lang.management.OperatingSystemMXBean;
-import java.util.concurrent.TimeUnit;
import java.util.Date;
import java.text.SimpleDateFormat;
@@ -58,8 +57,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.Assume;
-import akka.zeromq.SocketType;
-
public class ZeromqDocTestBase {
ActorSystem system;
@@ -95,12 +92,12 @@ public class ZeromqDocTestBase {
//#sub-topic-socket
//#unsub-topic-socket
- subTopicSocket.tell(new Unsubscribe("foo.bar"));
+ subTopicSocket.tell(new Unsubscribe("foo.bar"), null);
//#unsub-topic-socket
byte[] payload = new byte[0];
//#pub-topic
- pubSocket.tell(new ZMQMessage(new Frame("foo.bar"), new Frame(payload)));
+ pubSocket.tell(new ZMQMessage(new Frame("foo.bar"), new Frame(payload)), null);
//#pub-topic
//#high-watermark
@@ -205,12 +202,12 @@ public class ZeromqDocTestBase {
byte[] heapPayload = ser.serializerFor(Heap.class).toBinary(
new Heap(timestamp, currentHeap.getUsed(), currentHeap.getMax()));
// the first frame is the topic, second is the message
- pubSocket.tell(new ZMQMessage(new Frame("health.heap"), new Frame(heapPayload)));
+ pubSocket.tell(new ZMQMessage(new Frame("health.heap"), new Frame(heapPayload)), getSelf());
// use akka SerializationExtension to convert to bytes
byte[] loadPayload = ser.serializerFor(Load.class).toBinary(new Load(timestamp, os.getSystemLoadAverage()));
// the first frame is the topic, second is the message
- pubSocket.tell(new ZMQMessage(new Frame("health.load"), new Frame(loadPayload)));
+ pubSocket.tell(new ZMQMessage(new Frame("health.load"), new Frame(loadPayload)), getSelf());
} else {
unhandled(message);
}
diff --git a/akka-docs/java/dispatchers.rst b/akka-docs/rst/java/dispatchers.rst
similarity index 100%
rename from akka-docs/java/dispatchers.rst
rename to akka-docs/rst/java/dispatchers.rst
diff --git a/akka-docs/java/event-bus.rst b/akka-docs/rst/java/event-bus.rst
similarity index 100%
rename from akka-docs/java/event-bus.rst
rename to akka-docs/rst/java/event-bus.rst
diff --git a/akka-docs/java/extending-akka.rst b/akka-docs/rst/java/extending-akka.rst
similarity index 100%
rename from akka-docs/java/extending-akka.rst
rename to akka-docs/rst/java/extending-akka.rst
diff --git a/akka-docs/java/fault-tolerance-sample.rst b/akka-docs/rst/java/fault-tolerance-sample.rst
similarity index 100%
rename from akka-docs/java/fault-tolerance-sample.rst
rename to akka-docs/rst/java/fault-tolerance-sample.rst
diff --git a/akka-docs/java/fault-tolerance.rst b/akka-docs/rst/java/fault-tolerance.rst
similarity index 100%
rename from akka-docs/java/fault-tolerance.rst
rename to akka-docs/rst/java/fault-tolerance.rst
diff --git a/akka-docs/java/fsm.rst b/akka-docs/rst/java/fsm.rst
similarity index 100%
rename from akka-docs/java/fsm.rst
rename to akka-docs/rst/java/fsm.rst
diff --git a/akka-docs/java/futures.rst b/akka-docs/rst/java/futures.rst
similarity index 100%
rename from akka-docs/java/futures.rst
rename to akka-docs/rst/java/futures.rst
diff --git a/akka-docs/java/howto.rst b/akka-docs/rst/java/howto.rst
similarity index 100%
rename from akka-docs/java/howto.rst
rename to akka-docs/rst/java/howto.rst
diff --git a/akka-docs/java/index.rst b/akka-docs/rst/java/index.rst
similarity index 100%
rename from akka-docs/java/index.rst
rename to akka-docs/rst/java/index.rst
diff --git a/akka-docs/java/logging.rst b/akka-docs/rst/java/logging.rst
similarity index 100%
rename from akka-docs/java/logging.rst
rename to akka-docs/rst/java/logging.rst
diff --git a/akka-docs/java/microkernel.rst b/akka-docs/rst/java/microkernel.rst
similarity index 90%
rename from akka-docs/java/microkernel.rst
rename to akka-docs/rst/java/microkernel.rst
index 970b174549..3d89c5c7e6 100644
--- a/akka-docs/java/microkernel.rst
+++ b/akka-docs/rst/java/microkernel.rst
@@ -36,7 +36,7 @@ On a Windows machine you can also use the bin/akka.bat script.
The code for the Hello Kernel example (see the ``HelloKernel`` class for an example
of creating a Bootable):
-.. includecode:: ../../akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
+.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
Distribution of microkernel application
@@ -48,12 +48,12 @@ start scripts.
To use the sbt plugin you define it in your ``project/plugins.sbt``:
-.. includecode:: ../../akka-sbt-plugin/sample/project/plugins.sbt
+.. includecode:: ../../../akka-sbt-plugin/sample/project/plugins.sbt
Then you add it to the settings of your ``project/Build.scala``. It is also important that you add the ``akka-kernel`` dependency.
This is an example of a complete sbt build file:
-.. includecode:: ../../akka-sbt-plugin/sample/project/Build.scala
+.. includecode:: ../../../akka-sbt-plugin/sample/project/Build.scala
Run the plugin with sbt::
diff --git a/akka-docs/java/remoting.rst b/akka-docs/rst/java/remoting.rst
similarity index 85%
rename from akka-docs/java/remoting.rst
rename to akka-docs/rst/java/remoting.rst
index 00ef0dbc75..e4c3d4b88f 100644
--- a/akka-docs/java/remoting.rst
+++ b/akka-docs/rst/java/remoting.rst
@@ -13,8 +13,8 @@ The Akka remoting is a separate jar file. Make sure that you have the following
com.typesafe.akka
- akka-remote
- 2.1-SNAPSHOT
+ akka-remote_@binVersion@
+ @version@
To enable remote capabilities in your Akka project you should, at a minimum, add the following changes
@@ -57,7 +57,7 @@ The example above only illustrates the bare minimum of properties you have to ad
There are lots of more properties that are related to remoting in Akka. We refer to the following
reference file for more information:
-.. literalinclude:: ../../akka-remote/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-remote/src/main/resources/reference.conf
:language: none
Looking up Remote Actors
@@ -116,6 +116,20 @@ As you can see from the example above the following pattern is used to find an `
object, which in most cases is not serializable. It is best to make a static
inner class which implements :class:`UntypedActorFactory`.
+.. warning::
+
+ *Caveat:* Remote deployment ties both systems together in a tight fashion,
+ where it may become impossible to shut down one system after the other has
+ become unreachable. This is due to a missing feature—which will be part of
+ the clustering support—that hooks up network failure detection with
+ DeathWatch. If you want to avoid this strong coupling, do not remote-deploy
+ but send ``Props`` to a remotely looked-up actor and have that create a
+ child, returning the resulting actor reference.
+
+.. warning::
+
+ *Caveat:* Akka Remoting does not trigger Death Watch for lost connections.
+
Programmatic Remote Deployment
------------------------------
@@ -178,7 +192,7 @@ This sample demonstrates both, remote deployment and look-up of remote actors.
First, let us have a look at the common setup for both scenarios (this is
``common.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/common.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/common.conf
This enables the remoting by installing the :class:`RemoteActorRefProvider` and
chooses the default remote transport. All other options will be set
@@ -198,39 +212,39 @@ In order to look up a remote actor, that one must be created first. For this
purpose, we configure an actor system to listen on port 2552 (this is a snippet
from ``application.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: calculator
Then the actor must be created. For all code which follows, assume these imports:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
:include: imports
The actor doing the work will be this one:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java
:include: actor
and we start it within an actor system using the above configuration
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java
:include: setup
With the service actor up and running, we may look it up from another actor
system, which will be configured to use port 2553 (this is a snippet from
``application.conf``).
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: remotelookup
The actor which will query the calculator is a quite simple one for demonstration purposes
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupActor.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupActor.java
:include: actor
and it is created from an actor system using the aforementioned client’s config.
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
:include: setup
Requests which come in via ``doSomething`` will be sent to the client actor
@@ -246,27 +260,27 @@ Creating remote actors instead of looking them up is not visible in the source
code, only in the configuration file. This section is used in this scenario
(this is a snippet from ``application.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: remotecreation
For all code which follows, assume these imports:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
:include: imports
The server actor can multiply or divide numbers:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java
:include: actor
The client actor looks like in the previous example
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationActor.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationActor.java
:include: actor
but the setup uses only ``actorOf``:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java
:include: setup
Observe how the name of the server actor matches the deployment given in the
diff --git a/akka-docs/java/routing.rst b/akka-docs/rst/java/routing.rst
similarity index 100%
rename from akka-docs/java/routing.rst
rename to akka-docs/rst/java/routing.rst
diff --git a/akka-docs/java/scheduler.rst b/akka-docs/rst/java/scheduler.rst
similarity index 89%
rename from akka-docs/java/scheduler.rst
rename to akka-docs/rst/java/scheduler.rst
index 28da7feeca..96b6934506 100644
--- a/akka-docs/java/scheduler.rst
+++ b/akka-docs/rst/java/scheduler.rst
@@ -37,14 +37,14 @@ Some examples
From ``akka.actor.ActorSystem``
-------------------------------
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/ActorSystem.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/ActorSystem.scala
:include: scheduler
The Scheduler interface
-----------------------
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
:include: scheduler
The Cancellable interface
@@ -55,6 +55,6 @@ This allows you to ``cancel`` something that has been scheduled for execution.
.. warning::
This does not abort the execution of the task, if it had already been started.
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
:include: cancellable
diff --git a/akka-docs/java/serialization.rst b/akka-docs/rst/java/serialization.rst
similarity index 100%
rename from akka-docs/java/serialization.rst
rename to akka-docs/rst/java/serialization.rst
diff --git a/akka-docs/java/stm.rst b/akka-docs/rst/java/stm.rst
similarity index 100%
rename from akka-docs/java/stm.rst
rename to akka-docs/rst/java/stm.rst
diff --git a/akka-docs/java/testing.rst b/akka-docs/rst/java/testing.rst
similarity index 97%
rename from akka-docs/java/testing.rst
rename to akka-docs/rst/java/testing.rst
index 6a3b10d91c..21692c23de 100644
--- a/akka-docs/java/testing.rst
+++ b/akka-docs/rst/java/testing.rst
@@ -46,8 +46,8 @@ The tools offered are described in detail in the following sections.
Be sure to add the module :mod:`akka-testkit` to your dependencies.
-Unit Testing with :class:`TestActorRef`
-=======================================
+Synchronous Unit Testing with :class:`TestActorRef`
+===================================================
Testing the business logic inside :class:`Actor` classes can be divided into
two parts: first, each atomic operation must work in isolation, then sequences
@@ -141,8 +141,8 @@ Feel free to experiment with the possibilities, and if you find useful
patterns, don't hesitate to let the Akka forums know about them! Who knows,
common operations might even be worked into nice DSLs.
-Integration Testing with :class:`JavaTestKit`
-=============================================
+Asynchronous Integration Testing with :class:`JavaTestKit`
+==========================================================
When you are reasonably sure that your actor's business logic is correct, the
next step is verifying that it works correctly within its intended environment.
@@ -489,6 +489,15 @@ queued invocations from all threads into its own queue and process them.
Limitations
-----------
+.. warning::
+
+ In case the CallingThreadDispatcher is used for top-level actors, but
+ without going through TestActorRef, then there is a time window during which
+ the actor is awaiting construction by the user guardian actor. Sending
+ messages to the actor during this time period will result in them being
+ enqueued and then executed on the guardian’s thread instead of the caller’s
+ thread. To avoid this, use TestActorRef.
+
If an actor's behavior blocks on a something which would normally be affected
by the calling actor after having sent the message, this will obviously
dead-lock when using this dispatcher. This is a common scenario in actor tests
diff --git a/akka-docs/java/transactors.rst b/akka-docs/rst/java/transactors.rst
similarity index 100%
rename from akka-docs/java/transactors.rst
rename to akka-docs/rst/java/transactors.rst
diff --git a/akka-docs/java/typed-actors.rst b/akka-docs/rst/java/typed-actors.rst
similarity index 100%
rename from akka-docs/java/typed-actors.rst
rename to akka-docs/rst/java/typed-actors.rst
diff --git a/akka-docs/java/untyped-actors.rst b/akka-docs/rst/java/untyped-actors.rst
similarity index 100%
rename from akka-docs/java/untyped-actors.rst
rename to akka-docs/rst/java/untyped-actors.rst
diff --git a/akka-docs/java/zeromq.rst b/akka-docs/rst/java/zeromq.rst
similarity index 100%
rename from akka-docs/java/zeromq.rst
rename to akka-docs/rst/java/zeromq.rst
diff --git a/akka-docs/modules/camel-async-interact.png b/akka-docs/rst/modules/camel-async-interact.png
similarity index 100%
rename from akka-docs/modules/camel-async-interact.png
rename to akka-docs/rst/modules/camel-async-interact.png
diff --git a/akka-docs/modules/camel-async-sequence.png b/akka-docs/rst/modules/camel-async-sequence.png
similarity index 100%
rename from akka-docs/modules/camel-async-sequence.png
rename to akka-docs/rst/modules/camel-async-sequence.png
diff --git a/akka-docs/modules/camel-custom-route.png b/akka-docs/rst/modules/camel-custom-route.png
similarity index 100%
rename from akka-docs/modules/camel-custom-route.png
rename to akka-docs/rst/modules/camel-custom-route.png
diff --git a/akka-docs/modules/camel-pubsub.png b/akka-docs/rst/modules/camel-pubsub.png
similarity index 100%
rename from akka-docs/modules/camel-pubsub.png
rename to akka-docs/rst/modules/camel-pubsub.png
diff --git a/akka-docs/modules/camel-pubsub2.png b/akka-docs/rst/modules/camel-pubsub2.png
similarity index 100%
rename from akka-docs/modules/camel-pubsub2.png
rename to akka-docs/rst/modules/camel-pubsub2.png
diff --git a/akka-docs/modules/camel.rst b/akka-docs/rst/modules/camel.rst
similarity index 100%
rename from akka-docs/modules/camel.rst
rename to akka-docs/rst/modules/camel.rst
diff --git a/akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocSpec.scala b/akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocSpec.scala
similarity index 100%
rename from akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocSpec.scala
rename to akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocSpec.scala
diff --git a/akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocTest.scala b/akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocTest.scala
similarity index 100%
rename from akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocTest.scala
rename to akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocTest.scala
diff --git a/akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java b/akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java
similarity index 94%
rename from akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java
rename to akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java
index 06e867c786..331aee0da7 100644
--- a/akka-docs/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java
+++ b/akka-docs/rst/modules/code/docs/actor/mailbox/DurableMailboxDocTestBase.java
@@ -18,8 +18,6 @@ import com.typesafe.config.ConfigFactory;
import akka.actor.ActorSystem;
import akka.actor.UntypedActor;
-import static org.junit.Assert.*;
-
public class DurableMailboxDocTestBase {
ActorSystem system;
@@ -41,7 +39,7 @@ public class DurableMailboxDocTestBase {
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class).
withDispatcher("my-dispatcher"), "myactor");
//#dispatcher-config-use
- myActor.tell("test");
+ myActor.tell("test", null);
}
public static class MyUntypedActor extends UntypedActor {
diff --git a/akka-docs/modules/durable-mailbox.rst b/akka-docs/rst/modules/durable-mailbox.rst
similarity index 97%
rename from akka-docs/modules/durable-mailbox.rst
rename to akka-docs/rst/modules/durable-mailbox.rst
index 5be40320d0..794ff0e751 100644
--- a/akka-docs/modules/durable-mailbox.rst
+++ b/akka-docs/rst/modules/durable-mailbox.rst
@@ -68,7 +68,7 @@ Corresponding example in Java:
You can also configure and tune the file-based durable mailbox. This is done in
the ``akka.actor.mailbox.file-based`` section in the :ref:`configuration`.
-.. literalinclude:: ../../akka-durable-mailboxes/akka-file-mailbox/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-durable-mailboxes/akka-file-mailbox/src/main/resources/reference.conf
:language: none
How to implement a durable mailbox
diff --git a/akka-docs/modules/http.rst b/akka-docs/rst/modules/http.rst
similarity index 100%
rename from akka-docs/modules/http.rst
rename to akka-docs/rst/modules/http.rst
diff --git a/akka-docs/modules/index.rst b/akka-docs/rst/modules/index.rst
similarity index 100%
rename from akka-docs/modules/index.rst
rename to akka-docs/rst/modules/index.rst
diff --git a/akka-docs/project/index.rst b/akka-docs/rst/project/index.rst
similarity index 100%
rename from akka-docs/project/index.rst
rename to akka-docs/rst/project/index.rst
diff --git a/akka-docs/project/issue-tracking.rst b/akka-docs/rst/project/issue-tracking.rst
similarity index 100%
rename from akka-docs/project/issue-tracking.rst
rename to akka-docs/rst/project/issue-tracking.rst
diff --git a/akka-docs/project/licenses.rst b/akka-docs/rst/project/licenses.rst
similarity index 100%
rename from akka-docs/project/licenses.rst
rename to akka-docs/rst/project/licenses.rst
diff --git a/akka-docs/project/links.rst b/akka-docs/rst/project/links.rst
similarity index 90%
rename from akka-docs/project/links.rst
rename to akka-docs/rst/project/links.rst
index 3002dc1216..238971d1ba 100644
--- a/akka-docs/project/links.rst
+++ b/akka-docs/rst/project/links.rst
@@ -57,7 +57,7 @@ http://repo.typesafe.com/typesafe/snapshots/ as both ``SNAPSHOT`` and
timestamped versions.
For timestamped versions, pick a timestamp from
-http://repo.typesafe.com/typesafe/snapshots/com/typesafe/akka/akka-actor/.
+http://repo.typesafe.com/typesafe/snapshots/com/typesafe/akka/akka-actor_@binVersion@/.
All Akka modules that belong to the same build have the same timestamp.
Make sure that you add the repository to the sbt resolvers or maven repositories::
@@ -66,6 +66,6 @@ Make sure that you add the repository to the sbt resolvers or maven repositories
Define the library dependencies with the timestamp as version. For example::
- libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0-20111215-000549"
+ libraryDependencies += "com.typesafe.akka" % "akka-actor_@binVersion@" % "2.1-20120913-000917"
- libraryDependencies += "com.typesafe.akka" % "akka-remote" % "2.0-20111215-000549"
+ libraryDependencies += "com.typesafe.akka" % "akka-remote_@binVersion@" % "2.1-20120913-000917"
diff --git a/akka-docs/project/migration-guide-1.3.x-2.0.x.rst b/akka-docs/rst/project/migration-guide-1.3.x-2.0.x.rst
similarity index 100%
rename from akka-docs/project/migration-guide-1.3.x-2.0.x.rst
rename to akka-docs/rst/project/migration-guide-1.3.x-2.0.x.rst
diff --git a/akka-docs/project/migration-guide-2.0.x-2.1.x.rst b/akka-docs/rst/project/migration-guide-2.0.x-2.1.x.rst
similarity index 99%
rename from akka-docs/project/migration-guide-2.0.x-2.1.x.rst
rename to akka-docs/rst/project/migration-guide-2.0.x-2.1.x.rst
index ec04dacdda..f5fa272ed2 100644
--- a/akka-docs/project/migration-guide-2.0.x-2.1.x.rst
+++ b/akka-docs/rst/project/migration-guide-2.0.x-2.1.x.rst
@@ -15,11 +15,7 @@ migrating `1.3.x to 2.0.x
+ */
+package docs.dataflow
+
+import language.postfixOps
+
+import scala.concurrent.util.duration._
+import scala.concurrent.{ Await, Future, Promise }
+import org.scalatest.WordSpec
+import org.scalatest.matchers.MustMatchers
+import scala.util.{ Try, Failure, Success }
+
+class DataflowDocSpec extends WordSpec with MustMatchers {
+
+ //#import-akka-dataflow
+ import akka.dataflow._ //to get the flow method and implicit conversions
+ //#import-akka-dataflow
+
+ //#import-global-implicit
+ import scala.concurrent.ExecutionContext.Implicits.global
+ //#import-global-implicit
+
+ "demonstrate flow using hello world" in {
+ def println[T](any: Try[T]): Unit = any.get must be === "Hello world!"
+ //#simplest-hello-world
+ flow { "Hello world!" } onComplete println
+ //#simplest-hello-world
+
+ //#nested-hello-world-a
+ flow {
+ val f1 = flow { "Hello" }
+ f1() + " world!"
+ } onComplete println
+ //#nested-hello-world-a
+
+ //#nested-hello-world-b
+ flow {
+ val f1 = flow { "Hello" }
+ val f2 = flow { "world!" }
+ f1() + " " + f2()
+ } onComplete println
+ //#nested-hello-world-b
+ }
+
+ "demonstrate the use of dataflow variables" in {
+ def println[T](any: Try[T]): Unit = any.get must be === 20
+ //#dataflow-variable-a
+ flow {
+ val v1, v2 = Promise[Int]()
+
+ // v1 will become the value of v2 + 10 when v2 gets a value
+ v1 << v2() + 10
+ v2 << flow { 5 } // As you can see, no blocking!
+ v1() + v2()
+ } onComplete println
+ //#dataflow-variable-a
+ }
+
+ "demonstrate the difference between for and flow" in {
+ def println[T](any: Try[T]): Unit = any.get must be === 2
+ //#for-vs-flow
+ val f1, f2 = Future { 1 }
+
+ val usingFor = for { v1 ← f1; v2 ← f2 } yield v1 + v2
+ val usingFlow = flow { f1() + f2() }
+
+ usingFor onComplete println
+ usingFlow onComplete println
+ //#for-vs-flow
+ }
+
+}
diff --git a/akka-docs/scala/code/docs/dispatcher/DispatcherDocSpec.scala b/akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/dispatcher/DispatcherDocSpec.scala
rename to akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala
diff --git a/akka-docs/scala/code/docs/event/LoggingDocSpec.scala b/akka-docs/rst/scala/code/docs/event/LoggingDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/event/LoggingDocSpec.scala
rename to akka-docs/rst/scala/code/docs/event/LoggingDocSpec.scala
diff --git a/akka-docs/scala/code/docs/extension/ExtensionDocSpec.scala b/akka-docs/rst/scala/code/docs/extension/ExtensionDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/extension/ExtensionDocSpec.scala
rename to akka-docs/rst/scala/code/docs/extension/ExtensionDocSpec.scala
diff --git a/akka-docs/scala/code/docs/extension/SettingsExtensionDocSpec.scala b/akka-docs/rst/scala/code/docs/extension/SettingsExtensionDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/extension/SettingsExtensionDocSpec.scala
rename to akka-docs/rst/scala/code/docs/extension/SettingsExtensionDocSpec.scala
diff --git a/akka-docs/scala/code/docs/future/FutureDocSpec.scala b/akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/future/FutureDocSpec.scala
rename to akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala
diff --git a/akka-docs/scala/code/docs/io/BinaryCoding.scala b/akka-docs/rst/scala/code/docs/io/BinaryCoding.scala
similarity index 100%
rename from akka-docs/scala/code/docs/io/BinaryCoding.scala
rename to akka-docs/rst/scala/code/docs/io/BinaryCoding.scala
diff --git a/akka-docs/scala/code/docs/io/HTTPServer.scala b/akka-docs/rst/scala/code/docs/io/HTTPServer.scala
similarity index 100%
rename from akka-docs/scala/code/docs/io/HTTPServer.scala
rename to akka-docs/rst/scala/code/docs/io/HTTPServer.scala
diff --git a/akka-docs/scala/code/docs/pattern/ScalaTemplate.scala b/akka-docs/rst/scala/code/docs/pattern/ScalaTemplate.scala
similarity index 100%
rename from akka-docs/scala/code/docs/pattern/ScalaTemplate.scala
rename to akka-docs/rst/scala/code/docs/pattern/ScalaTemplate.scala
diff --git a/akka-docs/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala b/akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala
rename to akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala
diff --git a/akka-docs/scala/code/docs/routing/ConsistentHashingRouterDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/ConsistentHashingRouterDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/routing/ConsistentHashingRouterDocSpec.scala
rename to akka-docs/rst/scala/code/docs/routing/ConsistentHashingRouterDocSpec.scala
diff --git a/akka-docs/scala/code/docs/routing/RouterDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/routing/RouterDocSpec.scala
rename to akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala
diff --git a/akka-docs/scala/code/docs/routing/RouterTypeExample.scala b/akka-docs/rst/scala/code/docs/routing/RouterTypeExample.scala
similarity index 97%
rename from akka-docs/scala/code/docs/routing/RouterTypeExample.scala
rename to akka-docs/rst/scala/code/docs/routing/RouterTypeExample.scala
index db711b565a..be43c4e48f 100644
--- a/akka-docs/scala/code/docs/routing/RouterTypeExample.scala
+++ b/akka-docs/rst/scala/code/docs/routing/RouterTypeExample.scala
@@ -29,7 +29,7 @@ class PrintlnActor extends Actor {
//#fibonacciActor
class FibonacciActor extends Actor {
def receive = {
- case FibonacciNumber(nbr) ⇒ sender tell fibonacci(nbr)
+ case FibonacciNumber(nbr) ⇒ sender ! fibonacci(nbr)
}
private def fibonacci(n: Int): Int = {
diff --git a/akka-docs/scala/code/docs/routing/RouterViaConfigDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/RouterViaConfigDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/routing/RouterViaConfigDocSpec.scala
rename to akka-docs/rst/scala/code/docs/routing/RouterViaConfigDocSpec.scala
diff --git a/akka-docs/rst/scala/code/docs/routing/RouterViaConfigExample.scala b/akka-docs/rst/scala/code/docs/routing/RouterViaConfigExample.scala
new file mode 100644
index 0000000000..5d34e429bb
--- /dev/null
+++ b/akka-docs/rst/scala/code/docs/routing/RouterViaConfigExample.scala
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2009-2012 Typesafe Inc.
+ */
+package docs.routing
+
+import akka.actor.{ Actor, Props, ActorSystem }
+import com.typesafe.config.ConfigFactory
+import akka.routing.FromConfig
+
+case class Message(nbr: Int)
+
+class ExampleActor extends Actor {
+ def receive = {
+ case Message(nbr) ⇒ println("Received %s in router %s".format(nbr, self.path.name))
+ }
+}
+
+object RouterWithConfigExample extends App {
+ val config = ConfigFactory.parseString("""
+ //#config
+ akka.actor.deployment {
+ /router {
+ router = round-robin
+ nr-of-instances = 5
+ }
+ }
+ //#config
+ //#config-resize
+ akka.actor.deployment {
+ /router2 {
+ router = round-robin
+ resizer {
+ lower-bound = 2
+ upper-bound = 15
+ }
+ }
+ }
+ //#config-resize
+ """)
+ val system = ActorSystem("Example", config)
+ //#configurableRouting
+ val router = system.actorOf(Props[ExampleActor].withRouter(FromConfig()),
+ "router")
+ //#configurableRouting
+ 1 to 10 foreach { i ⇒ router ! Message(i) }
+
+ //#configurableRoutingWithResizer
+ val router2 = system.actorOf(Props[ExampleActor].withRouter(FromConfig()),
+ "router2")
+ //#configurableRoutingWithResizer
+ 1 to 10 foreach { i ⇒ router2 ! Message(i) }
+}
\ No newline at end of file
diff --git a/akka-docs/scala/code/docs/routing/RouterViaProgramExample.scala b/akka-docs/rst/scala/code/docs/routing/RouterViaProgramExample.scala
similarity index 100%
rename from akka-docs/scala/code/docs/routing/RouterViaProgramExample.scala
rename to akka-docs/rst/scala/code/docs/routing/RouterViaProgramExample.scala
diff --git a/akka-docs/scala/code/docs/serialization/SerializationDocSpec.scala b/akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/serialization/SerializationDocSpec.scala
rename to akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala
diff --git a/akka-docs/scala/code/docs/testkit/PlainWordSpec.scala b/akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/testkit/PlainWordSpec.scala
rename to akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala
diff --git a/akka-docs/scala/code/docs/testkit/TestKitUsageSpec.scala b/akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/testkit/TestKitUsageSpec.scala
rename to akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala
diff --git a/akka-docs/scala/code/docs/testkit/TestkitDocSpec.scala b/akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/testkit/TestkitDocSpec.scala
rename to akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala
diff --git a/akka-docs/scala/code/docs/transactor/TransactorDocSpec.scala b/akka-docs/rst/scala/code/docs/transactor/TransactorDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/transactor/TransactorDocSpec.scala
rename to akka-docs/rst/scala/code/docs/transactor/TransactorDocSpec.scala
diff --git a/akka-docs/scala/code/docs/zeromq/ZeromqDocSpec.scala b/akka-docs/rst/scala/code/docs/zeromq/ZeromqDocSpec.scala
similarity index 100%
rename from akka-docs/scala/code/docs/zeromq/ZeromqDocSpec.scala
rename to akka-docs/rst/scala/code/docs/zeromq/ZeromqDocSpec.scala
diff --git a/akka-docs/rst/scala/dataflow.rst b/akka-docs/rst/scala/dataflow.rst
new file mode 100644
index 0000000000..c6185257c2
--- /dev/null
+++ b/akka-docs/rst/scala/dataflow.rst
@@ -0,0 +1,111 @@
+Dataflow Concurrency (Scala)
+============================
+
+Description
+-----------
+
+Akka implements `Oz-style dataflow concurrency `_
+by using a special API for :ref:`futures-scala` that enables a complimentary way of writing synchronous-looking code that in reality is asynchronous.
+
+The benefit of Dataflow concurrency is that it is deterministic; that means that it will always behave the same.
+If you run it once and it yields output 5 then it will do that **every time**, run it 10 million times - same result.
+If it on the other hand deadlocks the first time you run it, then it will deadlock **every single time** you run it.
+Also, there is **no difference** between sequential code and concurrent code. These properties makes it very easy to reason about concurrency.
+The limitation is that the code needs to be side-effect free, i.e. deterministic.
+You can't use exceptions, time, random etc., but need to treat the part of your program that uses dataflow concurrency as a pure function with input and output.
+
+The best way to learn how to program with dataflow variables is to read the fantastic book `Concepts, Techniques, and Models of Computer Programming `_. By Peter Van Roy and Seif Haridi.
+
+Getting Started (SBT)
+---------------------
+
+Scala's Delimited Continuations plugin is required to use the Dataflow API. To enable the plugin when using sbt, your project must inherit the ``AutoCompilerPlugins`` trait and contain a bit of configuration as is seen in this example:
+
+.. code-block:: scala
+
+ autoCompilerPlugins := true,
+ libraryDependencies <+= scalaVersion {
+ v => compilerPlugin("org.scala-lang.plugins" % "continuations" % @scalaVersion@)
+ },
+ scalacOptions += "-P:continuations:enable",
+
+
+You will also need to include a dependency on ``akka-dataflow``:
+
+.. code-block:: scala
+
+ "com.typesafe.akka" %% "akka-dataflow" % "@version@" @crossString@
+
+Dataflow variables
+------------------
+
+A Dataflow variable can be read any number of times but only be written to once, which maps very well to the concept of Futures/Promises :ref:`futures-scala`.
+Conversion from ``Future`` and ``Promise`` to Dataflow Variables is implicit and is invisible to the user (after importing akka.dataflow._).
+
+The mapping from ``Promise`` and ``Future`` is as follows:
+
+ - Futures are readable-many, using the ``apply`` method, inside ``flow`` blocks.
+ - Promises are readable-many, just like Futures.
+ - Promises are writable-once, using the ``<<`` operator, inside ``flow`` blocks.
+ Writing to an already written Promise throws a ``java.lang.IllegalStateException``,
+ this has the effect that races to write a promise will be deterministic,
+ only one of the writers will succeed and the others will fail.
+
+The flow
+--------
+
+The ``flow`` method acts as the delimiter of dataflow expressions (this also neatly aligns with the concept of delimited continuations),
+and flow-expressions compose. At this point you might wonder what the ``flow``-construct brings to the table that for-comprehensions don't,
+and that is the use of the CPS plugin that makes the *look like* it is synchronous, but in reality is asynchronous and non-blocking.
+The result of a call to ``flow`` is a Future with the resulting value of the flow.
+
+To be able to use the ``flow`` method, you need to import:
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: import-akka-dataflow
+
+The ``flow`` method will, just like Futures and Promises, require an implicit ``ExecutionContext`` in scope.
+For the examples here we will use:
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: import-global-implicit
+
+Using flow
+~~~~~~~~~~
+
+First off we have the obligatory "Hello world!":
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: simplest-hello-world
+
+You can also refer to the results of other flows within flows:
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: nested-hello-world-a
+
+… or:
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: nested-hello-world-b
+
+Working with variables
+~~~~~~~~~~~~~~~~~~~~~~
+
+Inside the flow method you can use Promises as Dataflow variables:
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: dataflow-variable-a
+
+Flow compared to for
+--------------------
+
+Should I use Dataflow or for-comprehensions?
+
+.. includecode:: code/docs/dataflow/DataflowDocSpec.scala
+ :include: for-vs-flow
+
+Conclusions:
+
+ - Dataflow has a smaller code footprint and arguably is easier to reason about.
+ - For-comprehensions are more general than Dataflow, and can operate on a wide array of types.
+
diff --git a/akka-docs/scala/dispatchers.rst b/akka-docs/rst/scala/dispatchers.rst
similarity index 100%
rename from akka-docs/scala/dispatchers.rst
rename to akka-docs/rst/scala/dispatchers.rst
diff --git a/akka-docs/scala/event-bus.rst b/akka-docs/rst/scala/event-bus.rst
similarity index 100%
rename from akka-docs/scala/event-bus.rst
rename to akka-docs/rst/scala/event-bus.rst
diff --git a/akka-docs/scala/extending-akka.rst b/akka-docs/rst/scala/extending-akka.rst
similarity index 100%
rename from akka-docs/scala/extending-akka.rst
rename to akka-docs/rst/scala/extending-akka.rst
diff --git a/akka-docs/scala/fault-tolerance-sample.rst b/akka-docs/rst/scala/fault-tolerance-sample.rst
similarity index 100%
rename from akka-docs/scala/fault-tolerance-sample.rst
rename to akka-docs/rst/scala/fault-tolerance-sample.rst
diff --git a/akka-docs/scala/fault-tolerance.rst b/akka-docs/rst/scala/fault-tolerance.rst
similarity index 100%
rename from akka-docs/scala/fault-tolerance.rst
rename to akka-docs/rst/scala/fault-tolerance.rst
diff --git a/akka-docs/scala/fsm.rst b/akka-docs/rst/scala/fsm.rst
similarity index 100%
rename from akka-docs/scala/fsm.rst
rename to akka-docs/rst/scala/fsm.rst
diff --git a/akka-docs/scala/futures.rst b/akka-docs/rst/scala/futures.rst
similarity index 100%
rename from akka-docs/scala/futures.rst
rename to akka-docs/rst/scala/futures.rst
diff --git a/akka-docs/scala/howto.rst b/akka-docs/rst/scala/howto.rst
similarity index 79%
rename from akka-docs/scala/howto.rst
rename to akka-docs/rst/scala/howto.rst
index bcaa456b82..7d064e2491 100644
--- a/akka-docs/scala/howto.rst
+++ b/akka-docs/rst/scala/howto.rst
@@ -21,7 +21,7 @@ Contributed by: Kaspar Fischer
"A message throttler that ensures that messages are not sent out at too high a rate."
-The pattern is described `here `_.
+The pattern is described in `Throttling Messages in Akka 2 `_.
Balancing Workload Across Nodes
===============================
@@ -32,7 +32,7 @@ Contributed by: Derek Wyatt
stipulation that the Actors doing the work have distinct Mailboxes on remote
nodes. In this post we’ll explore the implementation of such a concept."
-The pattern is described `here `_.
+The pattern is described `Balancing Workload across Nodes with Akka 2 `_.
Ordered Termination
===================
@@ -46,7 +46,7 @@ If an Actor has children that have order dependencies, then you might need to en
a particular shutdown order of those children so that their postStop() methods get
called in the right order."
-The pattern is described `here `_.
+The pattern is described `An Akka 2 Terminator `_.
Akka AMQP Proxies
=================
@@ -57,7 +57,7 @@ Contributed by: Fabrice Drouin
You still write “local” code, have very little to configure, and end up with a distributed, elastic,
fault-tolerant grid where computing nodes can be written in nearly every programming language."
-The pattern is described `here `_.
+The pattern is described `Akka AMQP Proxies `_.
Shutdown Patterns in Akka 2
===========================
@@ -72,7 +72,7 @@ She’s just plain mean.
In this post, we’ll discuss why this is the case and provide you with a simple option for shutting down “at the right time”,
as well as a not-so-simple-option for doing the exact same thing."
-The pattern is described `here `_.
+The pattern is described `Shutdown Patterns in Akka 2 `_.
Distributed (in-memory) graph processing with Akka
==================================================
@@ -83,7 +83,7 @@ Contributed by: Adelbert Chang
and have become even more interesting in the context of online social networks such as Facebook and Twitter,
whose underlying network structures are nicely represented by graphs."
-The pattern is described `here `_.
+The pattern is described `Distributed In-Memory Graph Processing with Akka `_.
Case Study: An Auto-Updating Cache Using Actors
===============================================
@@ -96,7 +96,7 @@ The data in the backend system is constantly being updated so the caches need to
Requests to the backend system need to be throttled.
The caching system we built used Akka actors and Scala’s support for functions as first class objects."
-The pattern is described `here `_.
+The pattern is described `Case Study: An Auto-Updating Cache using Actors `_.
Discovering message flows in actor systems with the Spider Pattern
==================================================================
@@ -109,7 +109,7 @@ on several machines to find out what’s going on. I’m sure you have browsed t
This is where the Spider pattern comes in."
-The pattern is described `here `_.
+The pattern is described `Discovering Message Flows in Actor System with the Spider Pattern `_.
Template Pattern
================
diff --git a/akka-docs/scala/index.rst b/akka-docs/rst/scala/index.rst
similarity index 100%
rename from akka-docs/scala/index.rst
rename to akka-docs/rst/scala/index.rst
diff --git a/akka-docs/scala/io.rst b/akka-docs/rst/scala/io.rst
similarity index 100%
rename from akka-docs/scala/io.rst
rename to akka-docs/rst/scala/io.rst
diff --git a/akka-docs/scala/logging.rst b/akka-docs/rst/scala/logging.rst
similarity index 100%
rename from akka-docs/scala/logging.rst
rename to akka-docs/rst/scala/logging.rst
diff --git a/akka-docs/scala/microkernel.rst b/akka-docs/rst/scala/microkernel.rst
similarity index 90%
rename from akka-docs/scala/microkernel.rst
rename to akka-docs/rst/scala/microkernel.rst
index c2bc95cb8b..c223f9dd45 100644
--- a/akka-docs/scala/microkernel.rst
+++ b/akka-docs/rst/scala/microkernel.rst
@@ -36,7 +36,7 @@ On a Windows machine you can also use the bin/akka.bat script.
The code for the Hello Kernel example (see the ``HelloKernel`` class for an example
of creating a Bootable):
-.. includecode:: ../../akka-samples/akka-sample-hello-kernel/src/main/scala/sample/kernel/hello/HelloKernel.scala
+.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/src/main/scala/sample/kernel/hello/HelloKernel.scala
Distribution of microkernel application
@@ -48,12 +48,12 @@ start scripts.
To use the sbt plugin you define it in your ``project/plugins.sbt``:
-.. includecode:: ../../akka-sbt-plugin/sample/project/plugins.sbt
+.. includecode:: ../../../akka-sbt-plugin/sample/project/plugins.sbt
Then you add it to the settings of your ``project/Build.scala``. It is also important that you add the ``akka-kernel`` dependency.
This is an example of a complete sbt build file:
-.. includecode:: ../../akka-sbt-plugin/sample/project/Build.scala
+.. includecode:: ../../../akka-sbt-plugin/sample/project/Build.scala
Run the plugin with sbt::
diff --git a/akka-docs/scala/remoting.rst b/akka-docs/rst/scala/remoting.rst
similarity index 86%
rename from akka-docs/scala/remoting.rst
rename to akka-docs/rst/scala/remoting.rst
index a5fef69d8d..41f241ada0 100644
--- a/akka-docs/scala/remoting.rst
+++ b/akka-docs/rst/scala/remoting.rst
@@ -12,7 +12,7 @@ Preparing your ActorSystem for Remoting
The Akka remoting is a separate jar file. Make sure that you have the following dependency in your project::
- "com.typesafe.akka" % "akka-remote" % "2.1-SNAPSHOT"
+ "com.typesafe.akka" %% "akka-remote" % "@version@" @crossString@
To enable remote capabilities in your Akka project you should, at a minimum, add the following changes
to your ``application.conf`` file::
@@ -54,7 +54,7 @@ The example above only illustrates the bare minimum of properties you have to ad
There are lots of more properties that are related to remoting in Akka. We refer to the following
reference file for more information:
-.. literalinclude:: ../../akka-remote/src/main/resources/reference.conf
+.. literalinclude:: ../../../akka-remote/src/main/resources/reference.conf
:language: none
Types of Remote Interaction
@@ -125,6 +125,20 @@ actor systems has to have a JAR containing the class.
most cases is not serializable. It is best to create a factory method in the
companion object of the actor’s class.
+.. warning::
+
+ *Caveat:* Remote deployment ties both systems together in a tight fashion,
+ where it may become impossible to shut down one system after the other has
+ become unreachable. This is due to a missing feature—which will be part of
+ the clustering support—that hooks up network failure detection with
+ DeathWatch. If you want to avoid this strong coupling, do not remote-deploy
+ but send ``Props`` to a remotely looked-up actor and have that create a
+ child, returning the resulting actor reference.
+
+.. warning::
+
+ *Caveat:* Akka Remoting does not trigger Death Watch for lost connections.
+
Programmatic Remote Deployment
------------------------------
@@ -187,7 +201,7 @@ This sample demonstrates both, remote deployment and look-up of remote actors.
First, let us have a look at the common setup for both scenarios (this is
``common.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/common.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/common.conf
This enables the remoting by installing the :class:`RemoteActorRefProvider` and
chooses the default remote transport. All other options will be set
@@ -207,39 +221,39 @@ In order to look up a remote actor, that one must be created first. For this
purpose, we configure an actor system to listen on port 2552 (this is a snippet
from ``application.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: calculator
Then the actor must be created. For all code which follows, assume these imports:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
:include: imports
The actor doing the work will be this one:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CalculatorApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CalculatorApplication.scala
:include: actor
and we start it within an actor system using the above configuration
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CalculatorApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CalculatorApplication.scala
:include: setup
With the service actor up and running, we may look it up from another actor
system, which will be configured to use port 2553 (this is a snippet from
``application.conf``).
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: remotelookup
The actor which will query the calculator is a quite simple one for demonstration purposes
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
:include: actor
and it is created from an actor system using the aforementioned client’s config.
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
:include: setup
Requests which come in via ``doSomething`` will be sent to the client actor
@@ -255,22 +269,22 @@ Creating remote actors instead of looking them up is not visible in the source
code, only in the configuration file. This section is used in this scenario
(this is a snippet from ``application.conf``):
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/resources/application.conf
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/resources/application.conf
:include: remotecreation
For all code which follows, assume these imports:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/LookupApplication.scala
:include: imports
The client actor looks like in the previous example
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CreationApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CreationApplication.scala
:include: actor
but the setup uses only ``actorOf``:
-.. includecode:: ../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CreationApplication.scala
+.. includecode:: ../../../akka-samples/akka-sample-remote/src/main/scala/sample/remote/calculator/CreationApplication.scala
:include: setup
Observe how the name of the server actor matches the deployment given in the
diff --git a/akka-docs/scala/routing.rst b/akka-docs/rst/scala/routing.rst
similarity index 97%
rename from akka-docs/scala/routing.rst
rename to akka-docs/rst/scala/routing.rst
index c1fa21b23f..9dc356c98c 100644
--- a/akka-docs/scala/routing.rst
+++ b/akka-docs/rst/scala/routing.rst
@@ -126,7 +126,7 @@ not have an effect on the number of actors in the pool.
Setting the strategy is easily done:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#supervision
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#supervision
:include: supervision
:exclude: custom-strategy
@@ -378,12 +378,12 @@ democrat related messages to the Democrat actor and all republican related messa
We begin with defining the class:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRouter
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRouter
:exclude: crRoute
The next step is to implement the ``createRoute`` method in the class just defined:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRoute
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRoute
As you can see above we start off by creating the routees and put them in a collection.
@@ -392,12 +392,12 @@ It registers the routees internally and failing to call this method will
cause a ``ActorInitializationException`` to be thrown when the router is used.
Therefore always make sure to do the following in your custom router:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRegisterRoutees
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRegisterRoutees
The routing logic is where your magic sauce is applied. In our example it inspects the message types
and forwards to the correct routee based on this:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRoutingLogic
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#crRoutingLogic
As you can see above what's returned in the partial function is a ``List`` of ``Destination(sender, routee)``.
The sender is what "parent" the routee should see - changing this could be useful if you for example want
@@ -407,7 +407,7 @@ For more information about how to alter the original sender we refer to the sour
All in all the custom router looks like this:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#CustomRouter
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#CustomRouter
If you are interested in how to use the VoteCountRouter you can have a look at the test class
`RoutingSpec `_
diff --git a/akka-docs/scala/scheduler.rst b/akka-docs/rst/scala/scheduler.rst
similarity index 89%
rename from akka-docs/scala/scheduler.rst
rename to akka-docs/rst/scala/scheduler.rst
index 0a5b8aed51..e221752fac 100644
--- a/akka-docs/scala/scheduler.rst
+++ b/akka-docs/rst/scala/scheduler.rst
@@ -37,14 +37,14 @@ Some examples
From ``akka.actor.ActorSystem``
-------------------------------
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/ActorSystem.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/ActorSystem.scala
:include: scheduler
The Scheduler interface
-----------------------
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
:include: scheduler
The Cancellable interface
@@ -55,6 +55,6 @@ This allows you to ``cancel`` something that has been scheduled for execution.
.. warning::
This does not abort the execution of the task, if it had already been started.
-.. includecode:: ../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
+.. includecode:: ../../../akka-actor/src/main/scala/akka/actor/Scheduler.scala
:include: cancellable
diff --git a/akka-docs/scala/serialization.rst b/akka-docs/rst/scala/serialization.rst
similarity index 100%
rename from akka-docs/scala/serialization.rst
rename to akka-docs/rst/scala/serialization.rst
diff --git a/akka-docs/scala/stm.rst b/akka-docs/rst/scala/stm.rst
similarity index 100%
rename from akka-docs/scala/stm.rst
rename to akka-docs/rst/scala/stm.rst
diff --git a/akka-docs/scala/testing.rst b/akka-docs/rst/scala/testing.rst
similarity index 97%
rename from akka-docs/scala/testing.rst
rename to akka-docs/rst/scala/testing.rst
index 9ee9dca425..fadf39a2d8 100644
--- a/akka-docs/scala/testing.rst
+++ b/akka-docs/rst/scala/testing.rst
@@ -35,8 +35,8 @@ The tools offered are described in detail in the following sections.
Be sure to add the module :mod:`akka-testkit` to your dependencies.
-Unit Testing with :class:`TestActorRef`
-=======================================
+Synchronous Unit Testing with :class:`TestActorRef`
+===================================================
Testing the business logic inside :class:`Actor` classes can be divided into
two parts: first, each atomic operation must work in isolation, then sequences
@@ -151,8 +151,8 @@ Feel free to experiment with the possibilities, and if you find useful
patterns, don't hesitate to let the Akka forums know about them! Who knows,
common operations might even be worked into nice DSLs.
-Integration Testing with :class:`TestKit`
-=========================================
+Asynchronous Integration Testing with :class:`TestKit`
+======================================================
When you are reasonably sure that your actor's business logic is correct, the
next step is verifying that it works correctly within its intended environment
@@ -473,7 +473,7 @@ keep a test running and verify traces later you can also install an
This code can be used to forward messages, e.g. in a chain ``A --> Probe -->
B``, as long as a certain protocol is obeyed.
-.. includecode:: ../../akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala#autopilot
+.. includecode:: ../../../akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala#autopilot
The :meth:`run` method must return the auto-pilot for the next message, which
may be :class:`KeepRunning` to retain the current one or :class:`NoAutoPilot`
@@ -548,6 +548,15 @@ queued invocations from all threads into its own queue and process them.
Limitations
-----------
+.. warning::
+
+ In case the CallingThreadDispatcher is used for top-level actors, but
+ without going through TestActorRef, then there is a time window during which
+ the actor is awaiting construction by the user guardian actor. Sending
+ messages to the actor during this time period will result in them being
+ enqueued and then executed on the guardian’s thread instead of the caller’s
+ thread. To avoid this, use TestActorRef.
+
If an actor's behavior blocks on a something which would normally be affected
by the calling actor after having sent the message, this will obviously
dead-lock when using this dispatcher. This is a common scenario in actor tests
@@ -713,11 +722,11 @@ Testing Custom Router Logic
Given the following custom (dummy) router:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/CustomRouteSpec.scala#custom-router
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/CustomRouteSpec.scala#custom-router
This might be tested by dispatching messages and asserting their reception at
the right destinations, but that can be inconvenient. Therefore exists the
:obj:`ExtractRoute` extractor, which can be used like so:
-.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/CustomRouteSpec.scala#test-route
+.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/CustomRouteSpec.scala#test-route
diff --git a/akka-docs/scala/testkit-example.rst b/akka-docs/rst/scala/testkit-example.rst
similarity index 100%
rename from akka-docs/scala/testkit-example.rst
rename to akka-docs/rst/scala/testkit-example.rst
diff --git a/akka-docs/scala/transactors.rst b/akka-docs/rst/scala/transactors.rst
similarity index 100%
rename from akka-docs/scala/transactors.rst
rename to akka-docs/rst/scala/transactors.rst
diff --git a/akka-docs/scala/typed-actors.rst b/akka-docs/rst/scala/typed-actors.rst
similarity index 100%
rename from akka-docs/scala/typed-actors.rst
rename to akka-docs/rst/scala/typed-actors.rst
diff --git a/akka-docs/scala/zeromq.rst b/akka-docs/rst/scala/zeromq.rst
similarity index 100%
rename from akka-docs/scala/zeromq.rst
rename to akka-docs/rst/scala/zeromq.rst
diff --git a/akka-docs/scala/dataflow.rst b/akka-docs/scala/dataflow.rst
deleted file mode 100644
index 0953e72508..0000000000
--- a/akka-docs/scala/dataflow.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-Dataflow Concurrency (Scala)
-============================
-
-Description
------------
-
-To be continued.
-Currently under redevelopment due to Futures moving to the Scala Standard Library for 2.10.0
\ No newline at end of file
diff --git a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala
index 3aa3818de7..bfbb8529be 100644
--- a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala
+++ b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala
@@ -24,6 +24,7 @@ sealed trait RemoteLifeCycleEvent extends Serializable {
*/
trait RemoteClientLifeCycleEvent extends RemoteLifeCycleEvent {
def remoteAddress: Address
+ final def getRemoteAddress: Address = remoteAddress
}
/**
@@ -31,8 +32,8 @@ trait RemoteClientLifeCycleEvent extends RemoteLifeCycleEvent {
*/
case class RemoteClientError(
@BeanProperty cause: Throwable,
- @transient @BeanProperty remote: RemoteTransport,
- @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
+ @transient remote: RemoteTransport,
+ remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.ErrorLevel
override def toString: String = "RemoteClientError@" + remoteAddress + ": Error[" + Logging.stackTraceFor(cause) + "]"
}
@@ -42,7 +43,7 @@ case class RemoteClientError(
*/
case class RemoteClientDisconnected(
@transient @BeanProperty remote: RemoteTransport,
- @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
+ remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.DebugLevel
override def toString: String = "RemoteClientDisconnected@" + remoteAddress
}
@@ -52,7 +53,7 @@ case class RemoteClientDisconnected(
*/
case class RemoteClientConnected(
@transient @BeanProperty remote: RemoteTransport,
- @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
+ remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.DebugLevel
override def toString: String = "RemoteClientConnected@" + remoteAddress
}
@@ -62,7 +63,7 @@ case class RemoteClientConnected(
*/
case class RemoteClientStarted(
@transient @BeanProperty remote: RemoteTransport,
- @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
+ remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.InfoLevel
override def toString: String = "RemoteClientStarted@" + remoteAddress
}
@@ -72,7 +73,7 @@ case class RemoteClientStarted(
*/
case class RemoteClientShutdown(
@transient @BeanProperty remote: RemoteTransport,
- @BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
+ remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.InfoLevel
override def toString: String = "RemoteClientShutdown@" + remoteAddress
}
diff --git a/akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java b/akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
index d0ccc4ad79..77e579aa1e 100644
--- a/akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
+++ b/akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
@@ -13,28 +13,31 @@ public class HelloKernel implements Bootable {
final ActorSystem system = ActorSystem.create("hellokernel");
static class HelloActor extends UntypedActor {
- final ActorRef worldActor =
- getContext().actorOf(new Props(WorldActor.class));
+ final ActorRef worldActor = getContext().actorOf(
+ new Props(WorldActor.class));
- public void onReceive(Object message) {
- if (message == "start")
- worldActor.tell("Hello");
- else if (message instanceof String)
- System.out.println("Received message '%s'".format((String)message));
- else unhandled(message);
+ public void onReceive(Object message) {
+ if (message == "start")
+ worldActor.tell("Hello", getSelf());
+ else if (message instanceof String)
+ System.out.println(String.format("Received message '%s'", message));
+ else
+ unhandled(message);
+ }
}
-}
-static class WorldActor extends UntypedActor {
- public void onReceive(Object message) {
- if (message instanceof String)
- getSender().tell(((String)message).toUpperCase() + " world!");
- else unhandled(message);
+ static class WorldActor extends UntypedActor {
+ public void onReceive(Object message) {
+ if (message instanceof String)
+ getSender().tell(((String) message).toUpperCase() + " world!",
+ getSelf());
+ else
+ unhandled(message);
+ }
}
-}
public void startup() {
- system.actorOf(new Props(HelloActor.class)).tell("start");
+ system.actorOf(new Props(HelloActor.class)).tell("start", null);
}
public void shutdown() {
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java
index a8eaade104..bb04e4631d 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JAdvancedCalculatorActor.java
@@ -7,22 +7,28 @@ import akka.actor.UntypedActor;
//#actor
public class JAdvancedCalculatorActor extends UntypedActor {
- @Override
- public void onReceive(Object message) throws Exception {
-
- if (message instanceof Op.Multiply) {
- Op.Multiply multiply = (Op.Multiply) message;
- System.out.println("Calculating " + multiply.getN1() + " * " + multiply.getN2());
- getSender().tell(new Op.MultiplicationResult(multiply.getN1(), multiply.getN2(), multiply.getN1() * multiply.getN2()));
-
- } else if (message instanceof Op.Divide) {
- Op.Divide divide = (Op.Divide) message;
- System.out.println("Calculating " + divide.getN1() + " / " + divide.getN2());
- getSender().tell(new Op.DivisionResult(divide.getN1(), divide.getN2(), divide.getN1() / divide.getN2()));
+ @Override
+ public void onReceive(Object message) throws Exception {
- } else {
- unhandled(message);
- }
+ if (message instanceof Op.Multiply) {
+ Op.Multiply multiply = (Op.Multiply) message;
+ System.out.println("Calculating " + multiply.getN1() + " * "
+ + multiply.getN2());
+ getSender().tell(
+ new Op.MultiplicationResult(multiply.getN1(), multiply.getN2(),
+ multiply.getN1() * multiply.getN2()), getSelf());
+
+ } else if (message instanceof Op.Divide) {
+ Op.Divide divide = (Op.Divide) message;
+ System.out.println("Calculating " + divide.getN1() + " / "
+ + divide.getN2());
+ getSender().tell(
+ new Op.DivisionResult(divide.getN1(), divide.getN2(), divide.getN1()
+ / divide.getN2()), getSelf());
+
+ } else {
+ unhandled(message);
}
+ }
}
-//#actor
+// #actor
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalcApp.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalcApp.java
index 1bd183fcf0..2e840a1ff4 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalcApp.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalcApp.java
@@ -5,9 +5,9 @@ package sample.remote.calculator.java;
public class JCalcApp {
- public static void main(String[] args) {
- JCalculatorApplication app = new JCalculatorApplication();
- System.out.println("Started Calculator Application - waiting for messages");
- }
+ public static void main(String[] args) {
+ JCalculatorApplication app = new JCalculatorApplication();
+ System.out.println("Started Calculator Application - waiting for messages");
+ }
}
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java
index 8699e92ca2..916af2f5f8 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCalculatorApplication.java
@@ -11,20 +11,22 @@ import com.typesafe.config.ConfigFactory;
//#setup
public class JCalculatorApplication implements Bootable {
- private ActorSystem system;
+ private ActorSystem system;
- public JCalculatorApplication() {
- system = ActorSystem.create("CalculatorApplication", ConfigFactory.load().getConfig("calculator"));
- ActorRef actor = system.actorOf(new Props(JSimpleCalculatorActor.class), "simpleCalculator");
- }
+ public JCalculatorApplication() {
+ system = ActorSystem.create("CalculatorApplication", ConfigFactory.load()
+ .getConfig("calculator"));
+ ActorRef actor = system.actorOf(new Props(JSimpleCalculatorActor.class),
+ "simpleCalculator");
+ }
- @Override
- public void startup() {
- }
+ @Override
+ public void startup() {
+ }
- @Override
- public void shutdown() {
- system.shutdown();
- }
+ @Override
+ public void shutdown() {
+ system.shutdown();
+ }
}
-//#setup
\ No newline at end of file
+// #setup
\ No newline at end of file
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java
index 5b3d4f15a9..07a3a86d79 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JCreationApplication.java
@@ -11,27 +11,29 @@ import com.typesafe.config.ConfigFactory;
//#setup
public class JCreationApplication implements Bootable {
- private ActorSystem system;
- private ActorRef actor;
- private ActorRef remoteActor;
+ private ActorSystem system;
+ private ActorRef actor;
+ private ActorRef remoteActor;
- public JCreationApplication() {
- system = ActorSystem.create("CreationApplication", ConfigFactory.load().getConfig("remotecreation"));
- actor = system.actorOf(new Props(JCreationActor.class));
- remoteActor = system.actorOf(new Props(JAdvancedCalculatorActor.class), "advancedCalculator");
- }
+ public JCreationApplication() {
+ system = ActorSystem.create("CreationApplication", ConfigFactory.load()
+ .getConfig("remotecreation"));
+ actor = system.actorOf(new Props(JCreationActor.class));
+ remoteActor = system.actorOf(new Props(JAdvancedCalculatorActor.class),
+ "advancedCalculator");
+ }
- public void doSomething(Op.MathOp mathOp) {
- actor.tell(new InternalMsg.MathOpMsg(remoteActor, mathOp));
- }
+ public void doSomething(Op.MathOp mathOp) {
+ actor.tell(new InternalMsg.MathOpMsg(remoteActor, mathOp), null);
+ }
- @Override
- public void startup() {
- }
+ @Override
+ public void startup() {
+ }
- @Override
- public void shutdown() {
- system.shutdown();
- }
+ @Override
+ public void shutdown() {
+ system.shutdown();
+ }
}
-//#setup
+// #setup
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
index 5c2d050888..29294b6747 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JLookupApplication.java
@@ -7,34 +7,35 @@ package sample.remote.calculator.java;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
-import akka.actor.UntypedActor;
import akka.kernel.Bootable;
import com.typesafe.config.ConfigFactory;
//#imports
//#setup
public class JLookupApplication implements Bootable {
- private ActorSystem system;
- private ActorRef actor;
- private ActorRef remoteActor;
+ private ActorSystem system;
+ private ActorRef actor;
+ private ActorRef remoteActor;
- public JLookupApplication() {
- system = ActorSystem.create("LookupApplication", ConfigFactory.load().getConfig("remotelookup"));
- actor = system.actorOf(new Props(JLookupActor.class));
- remoteActor = system.actorFor("akka://CalculatorApplication@127.0.0.1:2552/user/simpleCalculator");
- }
+ public JLookupApplication() {
+ system = ActorSystem.create("LookupApplication", ConfigFactory.load()
+ .getConfig("remotelookup"));
+ actor = system.actorOf(new Props(JLookupActor.class));
+ remoteActor = system
+ .actorFor("akka://CalculatorApplication@127.0.0.1:2552/user/simpleCalculator");
+ }
- public void doSomething(Op.MathOp mathOp) {
- actor.tell(new InternalMsg.MathOpMsg(remoteActor, mathOp));
- }
+ public void doSomething(Op.MathOp mathOp) {
+ actor.tell(new InternalMsg.MathOpMsg(remoteActor, mathOp), null);
+ }
- @Override
- public void startup() {
- }
+ @Override
+ public void startup() {
+ }
- @Override
- public void shutdown() {
- system.shutdown();
- }
+ @Override
+ public void shutdown() {
+ system.shutdown();
+ }
}
-//#setup
+// #setup
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java
index 1b3373d84c..958fb6bee4 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/JSimpleCalculatorActor.java
@@ -7,22 +7,28 @@ import akka.actor.UntypedActor;
//#actor
public class JSimpleCalculatorActor extends UntypedActor {
- @Override
- public void onReceive(Object message) {
-
- if (message instanceof Op.Add) {
- Op.Add add = (Op.Add) message;
- System.out.println("Calculating " + add.getN1() + " + " + add.getN2());
- getSender().tell(new Op.AddResult(add.getN1(), add.getN2(), add.getN1() + add.getN2()));
-
- } else if (message instanceof Op.Subtract) {
- Op.Subtract subtract = (Op.Subtract) message;
- System.out.println("Calculating " + subtract.getN1() + " - " + subtract.getN2());
- getSender().tell(new Op.SubtractResult(subtract.getN1(), subtract.getN2(), subtract.getN1() - subtract.getN2()));
+ @Override
+ public void onReceive(Object message) {
- } else {
- unhandled(message);
- }
+ if (message instanceof Op.Add) {
+ Op.Add add = (Op.Add) message;
+ System.out.println("Calculating " + add.getN1() + " + " + add.getN2());
+ getSender()
+ .tell(
+ new Op.AddResult(add.getN1(), add.getN2(), add.getN1()
+ + add.getN2()), getSelf());
+
+ } else if (message instanceof Op.Subtract) {
+ Op.Subtract subtract = (Op.Subtract) message;
+ System.out.println("Calculating " + subtract.getN1() + " - "
+ + subtract.getN2());
+ getSender().tell(
+ new Op.SubtractResult(subtract.getN1(), subtract.getN2(),
+ subtract.getN1() - subtract.getN2()), getSelf());
+
+ } else {
+ unhandled(message);
}
+ }
}
-//#actor
+// #actor
diff --git a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/Op.java b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/Op.java
index 750d6dd705..17bd550d61 100644
--- a/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/Op.java
+++ b/akka-samples/akka-sample-remote/src/main/java/sample/remote/calculator/java/Op.java
@@ -7,175 +7,185 @@ import java.io.Serializable;
public class Op {
- public interface MathOp extends Serializable {}
+ public interface MathOp extends Serializable {
+ }
- public interface MathResult extends Serializable {}
+ public interface MathResult extends Serializable {
+ }
- static class Add implements MathOp {
- private final int n1;
- private final int n2;
+ static class Add implements MathOp {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
- public Add(int n1, int n2) {
- this.n1 = n1;
- this.n2 = n2;
- }
-
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
- }
-
- static class AddResult implements MathResult {
- private final int n1;
- private final int n2;
- private final int result;
-
- public AddResult(int n1, int n2, int result) {
- this.n1 = n1;
- this.n2 = n2;
- this.result = result;
- }
-
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
-
- public int getResult() {
- return result;
- }
+ public Add(int n1, int n2) {
+ this.n1 = n1;
+ this.n2 = n2;
}
- static class Subtract implements MathOp {
- private final int n1;
- private final int n2;
-
- public Subtract(int n1, int n2) {
- this.n1 = n1;
- this.n2 = n2;
- }
-
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
+ public int getN1() {
+ return n1;
}
- static class SubtractResult implements MathResult {
- private final int n1;
- private final int n2;
- private final int result;
+ public int getN2() {
+ return n2;
+ }
+ }
- public SubtractResult(int n1, int n2, int result) {
- this.n1 = n1;
- this.n2 = n2;
- this.result = result;
- }
+ static class AddResult implements MathResult {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
+ private final int result;
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
-
- public int getResult() {
- return result;
- }
+ public AddResult(int n1, int n2, int result) {
+ this.n1 = n1;
+ this.n2 = n2;
+ this.result = result;
}
- static class Multiply implements MathOp {
- private final int n1;
- private final int n2;
-
- public Multiply(int n1, int n2) {
- this.n1 = n1;
- this.n2 = n2;
- }
-
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
+ public int getN1() {
+ return n1;
}
- static class MultiplicationResult implements MathResult {
- private final int n1;
- private final int n2;
- private final int result;
-
- public MultiplicationResult(int n1, int n2, int result) {
- this.n1 = n1;
- this.n2 = n2;
- this.result = result;
- }
-
- public int getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
-
- public int getResult() {
- return result;
- }
+ public int getN2() {
+ return n2;
}
- static class Divide implements MathOp {
- private final double n1;
- private final int n2;
+ public int getResult() {
+ return result;
+ }
+ }
- public Divide(double n1, int n2) {
- this.n1 = n1;
- this.n2 = n2;
- }
+ static class Subtract implements MathOp {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
- public double getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
+ public Subtract(int n1, int n2) {
+ this.n1 = n1;
+ this.n2 = n2;
}
- static class DivisionResult implements MathResult {
- private final double n1;
- private final int n2;
- private final double result;
-
- public DivisionResult(double n1, int n2, double result) {
- this.n1 = n1;
- this.n2 = n2;
- this.result = result;
- }
-
- public double getN1() {
- return n1;
- }
-
- public int getN2() {
- return n2;
- }
-
- public double getResult() {
- return result;
- }
+ public int getN1() {
+ return n1;
}
+
+ public int getN2() {
+ return n2;
+ }
+ }
+
+ static class SubtractResult implements MathResult {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
+ private final int result;
+
+ public SubtractResult(int n1, int n2, int result) {
+ this.n1 = n1;
+ this.n2 = n2;
+ this.result = result;
+ }
+
+ public int getN1() {
+ return n1;
+ }
+
+ public int getN2() {
+ return n2;
+ }
+
+ public int getResult() {
+ return result;
+ }
+ }
+
+ static class Multiply implements MathOp {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
+
+ public Multiply(int n1, int n2) {
+ this.n1 = n1;
+ this.n2 = n2;
+ }
+
+ public int getN1() {
+ return n1;
+ }
+
+ public int getN2() {
+ return n2;
+ }
+ }
+
+ static class MultiplicationResult implements MathResult {
+ private static final long serialVersionUID = 1L;
+ private final int n1;
+ private final int n2;
+ private final int result;
+
+ public MultiplicationResult(int n1, int n2, int result) {
+ this.n1 = n1;
+ this.n2 = n2;
+ this.result = result;
+ }
+
+ public int getN1() {
+ return n1;
+ }
+
+ public int getN2() {
+ return n2;
+ }
+
+ public int getResult() {
+ return result;
+ }
+ }
+
+ static class Divide implements MathOp {
+ private static final long serialVersionUID = 1L;
+ private final double n1;
+ private final int n2;
+
+ public Divide(double n1, int n2) {
+ this.n1 = n1;
+ this.n2 = n2;
+ }
+
+ public double getN1() {
+ return n1;
+ }
+
+ public int getN2() {
+ return n2;
+ }
+ }
+
+ static class DivisionResult implements MathResult {
+ private static final long serialVersionUID = 1L;
+ private final double n1;
+ private final int n2;
+ private final double result;
+
+ public DivisionResult(double n1, int n2, double result) {
+ this.n1 = n1;
+ this.n2 = n2;
+ this.result = result;
+ }
+
+ public double getN1() {
+ return n1;
+ }
+
+ public int getN2() {
+ return n2;
+ }
+
+ public double getResult() {
+ return result;
+ }
+ }
}
diff --git a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala
index a187dfbeef..28aa4e0220 100644
--- a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala
+++ b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala
@@ -49,6 +49,9 @@ object TestActor {
}
val FALSE = (x: Any) ⇒ false
+
+ // make creator serializable, for VerifySerializabilitySpec
+ def props(queue: BlockingDeque[Message]): Props = Props(new TestActor(queue))
}
class TestActor(queue: BlockingDeque[TestActor.Message]) extends Actor {
@@ -112,9 +115,9 @@ trait TestKitBase {
* ActorRef of the test actor. Access is provided to enable e.g.
* registration as message target.
*/
- lazy val testActor: ActorRef = {
+ val testActor: ActorRef = {
val impl = system.asInstanceOf[ActorSystemImpl] //TODO ticket #1559
- val ref = impl.systemActorOf(Props(new TestActor(queue))
+ val ref = impl.systemActorOf(TestActor.props(queue)
.withDispatcher(CallingThreadDispatcher.Id),
"testActor" + TestKit.testActorId.incrementAndGet)
awaitCond(ref match {
diff --git a/akka-transactor/src/main/scala/akka/transactor/UntypedTransactor.scala b/akka-transactor/src/main/scala/akka/transactor/UntypedTransactor.scala
index 353695fd73..98899e0a13 100644
--- a/akka-transactor/src/main/scala/akka/transactor/UntypedTransactor.scala
+++ b/akka-transactor/src/main/scala/akka/transactor/UntypedTransactor.scala
@@ -23,7 +23,7 @@ abstract class UntypedTransactor extends UntypedActor {
case coordinated @ Coordinated(message) ⇒ {
val others = coordinate(message)
for (sendTo ← others) {
- sendTo.actor.tell(coordinated(sendTo.message.getOrElse(message)))
+ sendTo.actor ! coordinated(sendTo.message.getOrElse(message))
}
before(message)
coordinated.atomic { txn ⇒ atomically(message) }
diff --git a/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedCounter.java b/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedCounter.java
index 8760db5084..d1b3140416 100644
--- a/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedCounter.java
+++ b/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedCounter.java
@@ -4,13 +4,13 @@
package akka.transactor;
-import akka.actor.ActorRef;
-import akka.actor.UntypedActor;
-import scala.concurrent.stm.Ref;
-import scala.concurrent.stm.japi.STM;
import java.util.List;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+
+import scala.concurrent.stm.Ref;
+import scala.concurrent.stm.japi.STM;
+import akka.actor.ActorRef;
+import akka.actor.UntypedActor;
public class UntypedCoordinatedCounter extends UntypedActor {
private String name;
@@ -35,7 +35,7 @@ public class UntypedCoordinatedCounter extends UntypedActor {
};
if (!friends.isEmpty()) {
Increment coordMessage = new Increment(friends.subList(1, friends.size()), latch);
- friends.get(0).tell(coordinated.coordinate(coordMessage));
+ friends.get(0).tell(coordinated.coordinate(coordMessage), getSelf());
}
coordinated.atomic(new Runnable() {
public void run() {
@@ -45,7 +45,7 @@ public class UntypedCoordinatedCounter extends UntypedActor {
});
}
} else if ("GetCount".equals(incoming)) {
- getSender().tell(count.get());
+ getSender().tell(count.get(), getSelf());
}
}
}
diff --git a/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedIncrementTest.java b/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedIncrementTest.java
index 60c4873b27..5aecd341e0 100644
--- a/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedIncrementTest.java
+++ b/akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedIncrementTest.java
@@ -75,7 +75,7 @@ public class UntypedCoordinatedIncrementTest {
public void incrementAllCountersWithSuccessfulTransaction() throws Exception {
CountDownLatch incrementLatch = new CountDownLatch(numCounters);
Increment message = new Increment(counters.subList(1, counters.size()), incrementLatch);
- counters.get(0).tell(new Coordinated(message, timeout));
+ counters.get(0).tell(new Coordinated(message, timeout), null);
try {
incrementLatch.await(timeoutSeconds, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
@@ -97,7 +97,7 @@ public class UntypedCoordinatedIncrementTest {
List actors = new ArrayList(counters);
actors.add(failer);
Increment message = new Increment(actors.subList(1, actors.size()), incrementLatch);
- actors.get(0).tell(new Coordinated(message, timeout));
+ actors.get(0).tell(new Coordinated(message, timeout), null);
try {
incrementLatch.await(timeoutSeconds, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
diff --git a/akka-transactor/src/test/java/akka/transactor/UntypedCounter.java b/akka-transactor/src/test/java/akka/transactor/UntypedCounter.java
index 452e528a5c..1437adc805 100644
--- a/akka-transactor/src/test/java/akka/transactor/UntypedCounter.java
+++ b/akka-transactor/src/test/java/akka/transactor/UntypedCounter.java
@@ -4,15 +4,12 @@
package akka.transactor;
-import akka.actor.ActorRef;
-import akka.transactor.UntypedTransactor;
-import akka.transactor.SendTo;
-import scala.concurrent.stm.Ref;
-import scala.concurrent.stm.japi.STM;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+
+import scala.concurrent.stm.Ref;
+import scala.concurrent.stm.japi.STM;
+import akka.actor.ActorRef;
public class UntypedCounter extends UntypedTransactor {
private String name;
@@ -52,7 +49,7 @@ public class UntypedCounter extends UntypedTransactor {
@Override public boolean normally(Object message) {
if ("GetCount".equals(message)) {
- getSender().tell(count.get());
+ getSender().tell(count.get(), getSelf());
return true;
} else return false;
}
diff --git a/akka-transactor/src/test/java/akka/transactor/UntypedFailer.java b/akka-transactor/src/test/java/akka/transactor/UntypedFailer.java
index 2bc1c556d8..1e9b67998d 100644
--- a/akka-transactor/src/test/java/akka/transactor/UntypedFailer.java
+++ b/akka-transactor/src/test/java/akka/transactor/UntypedFailer.java
@@ -4,8 +4,6 @@
package akka.transactor;
-import scala.concurrent.stm.InTxn;
-
public class UntypedFailer extends UntypedTransactor {
public void atomically(Object message) throws Exception {
throw new ExpectedFailureException();
diff --git a/akka-transactor/src/test/java/akka/transactor/UntypedTransactorTest.java b/akka-transactor/src/test/java/akka/transactor/UntypedTransactorTest.java
index b24d000ced..5aae61d9c1 100644
--- a/akka-transactor/src/test/java/akka/transactor/UntypedTransactorTest.java
+++ b/akka-transactor/src/test/java/akka/transactor/UntypedTransactorTest.java
@@ -63,6 +63,8 @@ public class UntypedTransactorTest {
for (int i = 1; i <= numCounters; i++) {
final String name = "counter" + i;
ActorRef counter = system.actorOf(new Props(new UntypedActorFactory() {
+ private static final long serialVersionUID = 1L;
+
public UntypedActor create() {
return new UntypedCounter(name);
}
@@ -75,8 +77,9 @@ public class UntypedTransactorTest {
@Test
public void incrementAllCountersWithSuccessfulTransaction() throws Exception {
CountDownLatch incrementLatch = new CountDownLatch(numCounters);
- Increment message = new Increment(counters.subList(1, counters.size()), incrementLatch);
- counters.get(0).tell(message);
+ Increment message = new Increment(counters.subList(1, counters.size()),
+ incrementLatch);
+ counters.get(0).tell(message, null);
try {
incrementLatch.await(timeoutSeconds, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
@@ -90,15 +93,19 @@ public class UntypedTransactorTest {
@Test
public void incrementNoCountersWithFailingTransaction() throws Exception {
- EventFilter expectedFailureFilter = (EventFilter) new ErrorFilter(ExpectedFailureException.class);
- EventFilter coordinatedFilter = (EventFilter) new ErrorFilter(CoordinatedTransactionException.class);
- Seq ignoreExceptions = seq(expectedFailureFilter, coordinatedFilter);
+ EventFilter expectedFailureFilter = (EventFilter) new ErrorFilter(
+ ExpectedFailureException.class);
+ EventFilter coordinatedFilter = (EventFilter) new ErrorFilter(
+ CoordinatedTransactionException.class);
+ Seq ignoreExceptions = seq(expectedFailureFilter,
+ coordinatedFilter);
system.eventStream().publish(new TestEvent.Mute(ignoreExceptions));
CountDownLatch incrementLatch = new CountDownLatch(numCounters);
List actors = new ArrayList(counters);
actors.add(failer);
- Increment message = new Increment(actors.subList(1, actors.size()), incrementLatch);
- actors.get(0).tell(message);
+ Increment message = new Increment(actors.subList(1, actors.size()),
+ incrementLatch);
+ actors.get(0).tell(message, null);
try {
incrementLatch.await(timeoutSeconds, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
@@ -111,6 +118,8 @@ public class UntypedTransactorTest {
}
public Seq seq(A... args) {
- return JavaConverters.collectionAsScalaIterableConverter(Arrays.asList(args)).asScala().toSeq();
+ return JavaConverters
+ .collectionAsScalaIterableConverter(Arrays.asList(args)).asScala()
+ .toSeq();
}
}
diff --git a/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala b/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala
index d5d9370a2f..3226b874a1 100644
--- a/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala
+++ b/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala
@@ -18,8 +18,8 @@ class ConcurrentSocketActorSpec extends AkkaSpec {
def checkZeroMQInstallation =
try {
zmq.version match {
- case ZeroMQVersion(2, 1, _) ⇒ Unit
- case version ⇒ invalidZeroMQVersion(version)
+ case ZeroMQVersion(x, y, _) if x >= 3 || (x >= 2 && y >= 1) ⇒ Unit
+ case version ⇒ invalidZeroMQVersion(version)
}
} catch {
case e: LinkageError ⇒ zeroMQNotInstalled
diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala
index 9a11c119c8..91e4883aa3 100644
--- a/project/AkkaBuild.scala
+++ b/project/AkkaBuild.scala
@@ -15,7 +15,7 @@ import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
import java.lang.Boolean.getBoolean
import sbt.Tests
-import Sphinx.{ sphinxDocs, sphinxHtml, sphinxLatex, sphinxPdf, sphinxPygments, sphinxTags }
+import Sphinx.{ sphinxDocs, sphinxHtml, sphinxLatex, sphinxPdf, sphinxPygments, sphinxTags, sphinxVars, sphinxExts }
object AkkaBuild extends Build {
System.setProperty("akka.mode", "test") // Is there better place for this?
@@ -31,7 +31,7 @@ object AkkaBuild extends Build {
id = "akka",
base = file("."),
settings = parentSettings ++ Release.settings ++ Unidoc.settings ++ Sphinx.settings ++ Publish.versionSettings ++
- Dist.settings ++ mimaSettings ++ Seq(
+ Dist.settings ++ mimaSettings ++ sphinxReplacements ++ Seq(
testMailbox in GlobalScope := System.getProperty("akka.testMailbox", "false").toBoolean,
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
@@ -63,8 +63,9 @@ object AkkaBuild extends Build {
* line (without it, the pygments task would run twice in parallel for
* the same directory, wreaking the expected amount of havoc).
*/
- sphinxDocs <<= baseDirectory / "akka-docs",
+ sphinxDocs <<= baseDirectory / "akka-docs/rst",
sphinxTags in sphinxHtml += "online",
+ sphinxHtml <<= (sphinxHtml, sphinxHtml in LocalProject(docs.id)) map ((orig, dummy) => orig), // make akka-docs run first
sphinxPygments <<= sphinxPygments in LocalProject(docs.id) map identity,
sphinxLatex <<= sphinxLatex in LocalProject(docs.id) map identity,
sphinxPdf <<= sphinxPdf in LocalProject(docs.id) map identity
@@ -347,8 +348,8 @@ object AkkaBuild extends Build {
id = "akka-docs",
base = file("akka-docs"),
dependencies = Seq(actor, testkit % "test->test", mailboxesCommon % "compile;test->test",
- remote, cluster, slf4j, agent, transactor, fileMailbox, zeroMQ, camel, osgi, osgiAries),
- settings = defaultSettings ++ Sphinx.settings ++ Seq(
+ remote, cluster, slf4j, agent, dataflow, transactor, fileMailbox, zeroMQ, camel, osgi, osgiAries),
+ settings = defaultSettings ++ Sphinx.settings ++ sphinxReplacements ++ Seq(
unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get },
libraryDependencies ++= Dependencies.docs,
unmanagedSourceDirectories in ScalariformKeys.format in Test <<= unmanagedSourceDirectories in Test,
@@ -468,6 +469,31 @@ object AkkaBuild extends Build {
testOptions in Test += Tests.Argument("-oDF")
)
+ // customization of sphinx @@ replacements, add to all sphinx-using projects
+ // add additional replacements here
+ lazy val sphinxReplacements = Seq(
+ sphinxVars <<= (scalaVersion, version) { (s, v) =>
+ val BinVer = """(\d+\.\d+)\.\d+""".r
+ Map(
+ "version" -> v,
+ "scalaVersion" -> s,
+ "crossString" -> (s match {
+ case BinVer(_) => ""
+ case _ => "cross CrossVersion.full"
+ }),
+ "jarName" -> (s match {
+ case BinVer(bv) => "akka-actor_" + bv + "-" + v + ".jar"
+ case _ => "akka-actor_" + s + "-" + v + ".jar"
+ }),
+ "binVersion" -> (s match {
+ case BinVer(bv) => bv
+ case _ => s
+ })
+ )
+ },
+ sphinxExts += "py" // needed for transforming conf.py
+ )
+
lazy val formatSettings = ScalariformPlugin.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
diff --git a/project/Publish.scala b/project/Publish.scala
index c1a315e2a5..e368dcecfd 100644
--- a/project/Publish.scala
+++ b/project/Publish.scala
@@ -75,11 +75,10 @@ object Publish {
}
def akkaPluginPublishTo: Initialize[Option[Resolver]] = {
- (version) { version: String =>
- akkaPublishRepository orElse {
- val name = if (version.contains("-SNAPSHOT")) "sbt-plugin-snapshots" else "sbt-plugin-releases"
- Some(Resolver.url(name, url("http://scalasbt.artifactoryonline.com/scalasbt/" + name))(Resolver.ivyStylePatterns))
- }
+ (defaultPublishTo, version) { (default, version) =>
+ akkaPublishRepository orElse
+ pluginRepo(version) orElse
+ Some(Resolver.file("Default Local Repository", default))
}
}
@@ -91,6 +90,11 @@ object Publish {
}
}
+ def pluginRepo(version: String): Option[Resolver] =
+ Option(sys.props("publish.maven.central")) collect { case mc if mc.toLowerCase == "true" =>
+ val name = if (version endsWith "-SNAPSHOT") "sbt-plugin-snapshots" else "sbt-plugin-releases"
+ Resolver.url(name, url("http://scalasbt.artifactoryonline.com/scalasbt/" + name))(Resolver.ivyStylePatterns)
+ }
def akkaPublishRepository: Option[Resolver] =
Option(System.getProperty("akka.publish.repository", null)) map { "Akka Publish Repository" at _ }
diff --git a/project/Sphinx.scala b/project/Sphinx.scala
index b349265b60..2f13710917 100644
--- a/project/Sphinx.scala
+++ b/project/Sphinx.scala
@@ -6,40 +6,36 @@ package akka
import sbt._
import sbt.Keys._
-import java.io.File
+import java.io.{ File, PrintWriter }
object Sphinx {
val sphinxDocs = SettingKey[File]("sphinx-docs")
val sphinxTarget = SettingKey[File]("sphinx-target")
- val sphinxScalaVersion = TaskKey[String]("sphinx-scala-version")
val sphinxPygmentsDir = SettingKey[File]("sphinx-pygments-dir")
val sphinxTags = SettingKey[Seq[String]]("sphinx-tags")
val sphinxPygments = TaskKey[File]("sphinx-pygments", "Sphinx: install pygments styles")
val sphinxHtml = TaskKey[File]("sphinx-html", "Sphinx: HTML documentation.")
val sphinxLatex = TaskKey[File]("sphinx-latex", "Sphinx: Latex documentation.")
val sphinxPdf = TaskKey[File]("sphinx-pdf", "Sphinx: PDF documentation.")
+ val sphinxVars = SettingKey[Map[String, String]]("sphinx-vars", "mappings key->value to be replaced within docs")
+ val sphinxExts = SettingKey[Set[String]]("sphinx-exts", "file extensions which will be filtered for replacements")
val sphinx = TaskKey[File]("sphinx", "Build all Sphinx documentation (HTML and PDF combined).")
lazy val settings = Seq(
- sphinxDocs <<= baseDirectory,
+ sphinxDocs <<= baseDirectory / "rst",
sphinxTarget <<= crossTarget / "sphinx",
- sphinxScalaVersion <<= scalaVersionTask,
- sphinxPygmentsDir <<= sphinxDocs { _ / "_sphinx" / "pygments" },
+ sphinxPygmentsDir <<= sphinxDocs { _ / ".." / "_sphinx" / "pygments" },
sphinxTags in sphinxHtml := Seq.empty,
sphinxTags in sphinxLatex := Seq.empty,
sphinxPygments <<= pygmentsTask,
sphinxHtml <<= buildTask("html", sphinxTags in sphinxHtml),
sphinxLatex <<= buildTask("latex", sphinxTags in sphinxLatex),
sphinxPdf <<= pdfTask,
+ sphinxVars := Map("" -> "@"), // this default makes the @@ -> @ subst work
+ sphinxExts := Set("rst"),
sphinx <<= sphinxTask
)
- def scalaVersionTask = (scalaVersion, streams) map { (v, s) =>
- s.log.info("writing version file")
- IO.write(file("akka-docs/epilog_rst"), ".. |scalaVersion| replace:: " + v + "\n")
- v
- }
-
def pygmentsTask = (sphinxDocs, sphinxPygmentsDir, sphinxTarget, streams) map {
(cwd, pygments, baseTarget, s) => {
val target = baseTarget / "site-packages"
@@ -58,34 +54,63 @@ object Sphinx {
}
target
}
- } dependsOn sphinxScalaVersion
+ }
def buildTask(builder: String, tagsKey: SettingKey[Seq[String]]) = {
- (cacheDirectory, sphinxDocs, sphinxTarget, sphinxPygments, tagsKey, streams) map {
- (cacheDir, docs, baseTarget, pygments, tags, s) => {
+ (cacheDirectory, sphinxDocs, sphinxTarget, sphinxPygments, tagsKey, streams, sphinxVars, sphinxExts) map {
+ (cacheDir, docs, baseTarget, pygments, tags, s, replacements, filterExt) => {
val target = baseTarget / builder
val doctrees = baseTarget / "doctrees" / builder
+ val temp = docs.getParentFile / (docs.getName + "_" + builder)
val cache = cacheDir / "sphinx" / builder
val cached = FileFunction.cached(cache)(FilesInfo.hash, FilesInfo.exists) { (in, out) =>
- val changes = in.modified
- if (!changes.isEmpty) {
- IO.delete(target)
- val tagList = if (tags.isEmpty) "" else tags.mkString(" (", ", ", ")")
- val desc = "%s%s" format (builder, tagList)
- s.log.info("Building Sphinx %s documentation..." format desc)
- changes.foreach(file => s.log.debug("Changed documentation source: " + file))
- val logger = newLogger(s)
- val tagOptions = tags flatMap (Seq("-t", _))
- val command = Seq("sphinx-build", "-aEN", "-b", builder, "-d", doctrees.absolutePath) ++ tagOptions ++ Seq(docs.absolutePath, target.absolutePath)
- val env = "PYTHONPATH" -> pygments.absolutePath
- s.log.debug("Command: " + command.mkString(" "))
- val exitCode = Process(command, docs, env) ! logger
- if (exitCode != 0) sys.error("Failed to build Sphinx %s documentation." format desc)
- s.log.info("Sphinx %s documentation created: %s" format (desc, target))
- target.descendentsExcept("*", "").get.toSet
- } else Set.empty
+ def dst(f: File) = temp / IO.relativize(docs, f).get
+ def filter(f: File) = filterExt contains f.getName.reverse.takeWhile('.' !=).reverse
+ val Replacer = """@(\w+)@""".r
+ /*
+ * First Step: bring filtered source tree in sync with orig source tree
+ */
+ // delete files which were removed
+ in.removed foreach (f => IO delete dst(f))
+ // transform the other files by applying the replacement map for @@ tokens
+ (in.modified ++ (in.checked -- out.checked)).toSeq.sorted foreach { f =>
+ if (f.isFile)
+ if (filter(f)) {
+ s.log.debug("Changed documentation source: " + f)
+ IO.reader(f) { reader =>
+ IO.writer(dst(f), "", IO.defaultCharset, append = false) { writer =>
+ val wr = new PrintWriter(writer)
+ IO.foreachLine(reader) { line =>
+ wr.println(Replacer.replaceAllIn(line, m => replacements.getOrElse(m.group(1), {
+ s.log.warn("unknown replacement " + m.group(1) + " in " + replacements)
+ m.group(0)
+ })))
+ }
+ }
+ }
+ } else {
+ // do not transform PNGs et al
+ s.log.debug("Changed documentation source (copying): " + f)
+ IO.copyFile(f, dst(f))
+ }
+ }
+ /*
+ * Second Step: invoke sphinx-build
+ */
+ val tagList = if (tags.isEmpty) "" else tags.mkString(" (", ", ", ")")
+ val desc = "%s%s" format (builder, tagList)
+ s.log.info("Building Sphinx %s documentation..." format desc)
+ val logger = newLogger(s)
+ val tagOptions = tags flatMap (Seq("-t", _))
+ val command = Seq("sphinx-build", "-aEN", "-b", builder, "-d", doctrees.absolutePath) ++ tagOptions ++ Seq(temp.absolutePath, target.absolutePath)
+ val env = "PYTHONPATH" -> pygments.absolutePath
+ s.log.debug("Command: " + command.mkString(" "))
+ val exitCode = Process(command, docs, env) ! logger
+ if (exitCode != 0) sys.error("Failed to build Sphinx %s documentation." format desc)
+ s.log.info("Sphinx %s documentation created: %s" format (desc, target))
+ temp.descendentsExcept("*", "").get.toSet
}
- val toplevel = docs * ("*" - ".*" - "_sphinx" - "_build" - "disabled" - "target")
+ val toplevel = docs * ("*" - "disabled")
val inputs = toplevel.descendentsExcept("*", "").get.toSet
cached(inputs)
target
@@ -110,8 +135,13 @@ object Sphinx {
def newLogger(streams: TaskStreams) = {
new ProcessLogger {
- def info(o: => String): Unit = streams.log.debug(o)
- def error(e: => String): Unit = streams.log.debug(e)
+ def info(message: => String): Unit = {
+ val m = message
+ if (m contains "ERROR") streams.log.error(message)
+ else if (m contains "WARNING") streams.log.warn(message)
+ else streams.log.debug(message)
+ }
+ def error(e: => String): Unit = streams.log.warn(e)
def buffer[T](f: => T): T = f
}
}