fix some more comments and make Router dispatcher configurable
- assert locking balance when using Unsafe.instance.monitorExit - add RouterConfig.routerDispatcher - re-enable “busy” resizer test after switching to BalancingDispatcher - document resizer asynchronicity and how to configure dispatchers
This commit is contained in:
parent
bbe221e812
commit
36247b10fe
9 changed files with 170 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue