Merge pull request #1583 from akka/wip-3484-doc-router-supervision-patriknw

DOC: correct wrong advice in 'Routers and Supervision', see #3484
This commit is contained in:
Roland Kuhn 2013-07-04 05:05:47 -07:00
commit 3393221def
2 changed files with 14 additions and 8 deletions

View file

@ -131,15 +131,18 @@ turn, will cause its children to stop and restart.
It should be mentioned that the router's restart behavior has been overridden so that a restart,
while still re-creating the children, will still preserve the same number of actors in the pool.
This means that if you have not specified :meth:`supervisorStrategy` of the router or its parent a
failure in a routee will escalate to the parent of the router, which will by default restart the router,
which will restart all routees (it uses Escalate and does not stop routees during restart). The reason
is to make the default behave such that adding :meth:`.withRouter` to a childs definition does not
change the supervision strategy applied to the child. This might be an inefficiency that you can avoid
by specifying the strategy when defining the router.
Setting the strategy is easily done:
.. includecode:: code/docs/jrouting/CustomRouterDocTest.java
:include: supervision
Another potentially useful approach is to give the router the same strategy as
its parent, which effectively treats all actors in the pool as if they were
direct children of their grand-parent instead.
.. _note-router-terminated-children-java:
.. note::

View file

@ -132,16 +132,19 @@ turn, will cause its children to stop and restart.
It should be mentioned that the router's restart behavior has been overridden so that a restart,
while still re-creating the children, will still preserve the same number of actors in the pool.
This means that if you have not specified :meth:`supervisorStrategy` of the router or its parent a
failure in a routee will escalate to the parent of the router, which will by default restart the router,
which will restart all routees (it uses Escalate and does not stop routees during restart). The reason
is to make the default behave such that adding :meth:`.withRouter` to a childs definition does not
change the supervision strategy applied to the child. This might be an inefficiency that you can avoid
by specifying the strategy when defining the router.
Setting the strategy is easily done:
.. includecode:: ../../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#supervision
:include: supervision
:exclude: custom-strategy
Another potentially useful approach is to give the router the same strategy as
its parent, which effectively treats all actors in the pool as if they were
direct children of their grand-parent instead.
.. _note-router-terminated-children-scala:
.. note::