Merge branch 'wip-1804-router-create-race-∂π'

This commit is contained in:
Roland 2012-02-10 14:38:51 +01:00
commit 6786e45dc7
11 changed files with 288 additions and 77 deletions

View file

@ -17,6 +17,7 @@ import akka.util.Duration;
import akka.util.Timeout;
import akka.dispatch.Await;
import akka.dispatch.Future;
import akka.dispatch.Dispatchers;
import akka.testkit.AkkaSpec;
import com.typesafe.config.ConfigFactory;
import static akka.pattern.Patterns.ask;
@ -38,6 +39,19 @@ public class CustomRouterDocTestBase {
public void tearDown() {
system.shutdown();
}
public static class MyActor extends UntypedActor {
@Override public void onReceive(Object o) {}
}
@Test
public void demonstrateDispatchers() {
//#dispatchers
final ActorRef router = system.actorOf(new Props(MyActor.class)
.withRouter(new RoundRobinRouter(5).withDispatcher("head")) // head router runs on "head" dispatcher
.withDispatcher("workers")); // MyActor workers run on "workers" dispatcher
//#dispatchers
}
//#crTest
@Test
@ -105,6 +119,10 @@ public class CustomRouterDocTestBase {
//#crRouter
public static class VoteCountRouter extends CustomRouterConfig {
@Override public String routerDispatcher() {
return Dispatchers.DefaultDispatcherId();
}
//#crRoute
@Override