From 38d43aee13c6f771a5a5e94a32ac8d8554471ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Antonsson?= Date: Fri, 11 May 2012 18:31:20 +0200 Subject: [PATCH] Added caution about custom routers to docs --- akka-docs/java/routing.rst | 13 +++++++++++++ akka-docs/scala/routing.rst | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/akka-docs/java/routing.rst b/akka-docs/java/routing.rst index 110c5d3944..4d01642a72 100644 --- a/akka-docs/java/routing.rst +++ b/akka-docs/java/routing.rst @@ -339,6 +339,19 @@ If you are interested in how to use the VoteCountRouter it looks like this: .. includecode:: code/akka/docs/jrouting/CustomRouterDocTestBase.java#crTest +.. caution:: + + When creating a cutom router the resulting RoutedActorRef optimizes the + sending of the message so that it does NOT go through the router’s mailbox + unless the route returns an empty recipient set. + + This means that the ``route`` function defined in the ``RouterConfig`` + or the function returned from ``CreateCustomRoute`` in + ``CustomRouterConfig`` is evaluated concurrently without protection by + the RoutedActorRef: either provide a reentrant (i.e. pure) implementation + or do the locking yourself! + + Configured Custom Router ************************ diff --git a/akka-docs/scala/routing.rst b/akka-docs/scala/routing.rst index 22fac9c226..737c9e31e7 100644 --- a/akka-docs/scala/routing.rst +++ b/akka-docs/scala/routing.rst @@ -339,6 +339,19 @@ All in all the custom router looks like this: If you are interested in how to use the VoteCountRouter you can have a look at the test class `RoutingSpec `_ +.. caution:: + + When creating a cutom router the resulting RoutedActorRef optimizes the + sending of the message so that it does NOT go through the router’s mailbox + unless the route returns an empty recipient set. + + This means that the ``route`` function defined in the ``RouterConfig`` + or the function returned from ``CreateCustomRoute`` in + ``CustomRouterConfig`` is evaluated concurrently without protection by + the RoutedActorRef: either provide a reentrant (i.e. pure) implementation + or do the locking yourself! + + Configured Custom Router ************************