Merge pull request #1343 from akka/wip-2687-per-actor-class-configurable-mailboxes-ban

Allow different types of mailboxes on the same dispatcher #2687
This commit is contained in:
Björn Antonsson 2013-04-19 04:49:40 -07:00
commit bceef2648c
32 changed files with 735 additions and 74 deletions

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/
package docs.actor;
//#my-bounded-untyped-actor
import akka.dispatch.BoundedMessageQueueSemantics;
import akka.dispatch.RequiresMessageQueue;
public class MyBoundedUntypedActor extends MyUntypedActor
implements RequiresMessageQueue<BoundedMessageQueueSemantics> {
}
//#my-bounded-untyped-actor

View file

@ -30,6 +30,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
//#imports-custom
//#imports-required-mailbox
//#imports-required-mailbox
import docs.actor.MyBoundedUntypedActor;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -48,8 +53,8 @@ public class DispatcherDocTestBase {
@BeforeClass
public static void beforeAll() {
system = ActorSystem.create("MySystem",
ConfigFactory.parseString(
DispatcherDocSpec.config()).withFallback(AkkaSpec.testConf()));
ConfigFactory.parseString(DispatcherDocSpec.javaConfig()).withFallback(
ConfigFactory.parseString(DispatcherDocSpec.config())).withFallback(AkkaSpec.testConf()));
}
@AfterClass
@ -96,6 +101,33 @@ public class DispatcherDocTestBase {
//#lookup
}
@SuppressWarnings("unused")
@Test
public void defineMailboxInConfig() {
//#defining-mailbox-in-config
ActorRef myActor =
system.actorOf(Props.create(MyUntypedActor.class),
"priomailboxactor");
//#defining-mailbox-in-config
}
@SuppressWarnings("unused")
@Test
public void defineMailboxInCode() {
//#defining-mailbox-in-code
ActorRef myActor =
system.actorOf(Props.create(MyUntypedActor.class)
.withMailbox("prio-mailbox"));
//#defining-mailbox-in-code
}
@SuppressWarnings("unused")
@Test
public void usingARequiredMailbox() {
ActorRef myActor =
system.actorOf(Props.create(MyBoundedUntypedActor.class));
}
@Test
public void priorityDispatcher() throws Exception {
JavaTestKit probe = new JavaTestKit(system);