make supervisorStrategy of Router configurable, see #1835

- also do not scrap router’s children upon restart
- and add docs and tests
This commit is contained in:
Roland 2012-02-18 22:15:39 +01:00
parent c2376d01c0
commit 0f48b9f3eb
6 changed files with 300 additions and 6 deletions

View file

@ -52,6 +52,16 @@ public class CustomRouterDocTestBase {
.withDispatcher("workers")); // MyActor workers run on "workers" dispatcher
//#dispatchers
}
@Test
public void demonstrateSupervisor() {
//#supervision
final SupervisorStrategy strategy = new OneForOneStrategy(5, Duration.parse("1 minute"),
new Class<? extends Throwable>[] { Exception });
final ActorRef router = system.actorOf(new Props(MyActor.class)
.withRouter(new RoundRobinRouter(5).withSupervisorStrategy(strategy)));
//#supervision
}
//#crTest
@Test
@ -123,6 +133,10 @@ public class CustomRouterDocTestBase {
@Override public String routerDispatcher() {
return Dispatchers.DefaultDispatcherId();
}
@Override public SupervisorStrategy supervisorStrategy() {
return SupervisorStrategy.defaultStrategy();
}
//#crRoute
@Override