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 ************************