From d65ed2a007a3c49e607984c07203b8d419623557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Sat, 25 Aug 2012 13:05:27 +0300 Subject: [PATCH 1/2] Add warning about passing mutable state into the constructor of an Actor I was bitten by this when I created actors as a reaction in recieve, passing sender as parameter to the new Actor. --- akka-docs/scala/actors.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/akka-docs/scala/actors.rst b/akka-docs/scala/actors.rst index 548190c6fd..61843b412b 100644 --- a/akka-docs/scala/actors.rst +++ b/akka-docs/scala/actors.rst @@ -108,6 +108,9 @@ Here is an example: meaning of an actor restart, which is described here: :ref:`supervision-restart`. + Also avoid passing mutable state into the constructor of the Actor, since + the call-by-name block can be executed by another thread. + Props ----- From 15b225b7a652037d7ea8806191d17706ef52b8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Wed, 29 Aug 2012 17:11:31 +0200 Subject: [PATCH 2/2] Add warning block --- akka-docs/scala/actors.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/akka-docs/scala/actors.rst b/akka-docs/scala/actors.rst index 61843b412b..da242a9c57 100644 --- a/akka-docs/scala/actors.rst +++ b/akka-docs/scala/actors.rst @@ -108,6 +108,8 @@ Here is an example: meaning of an actor restart, which is described here: :ref:`supervision-restart`. +.. warning:: + Also avoid passing mutable state into the constructor of the Actor, since the call-by-name block can be executed by another thread.