summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
c098012)
Configured unit tests and production to use a control-aware mailbox
for Shard actors. The current code allows for a "shard-dispatcher"
to be defined so I added a section in the .conf that specifies the
mailbox-type appropriately (ie UnboundedDequeBasedControlAwareMailbox).
Change-Id: Ibdb404e1dfcc699471a8e899c491a09500ee04c0
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
import akka.actor.PoisonPill;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
import akka.actor.PoisonPill;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
+import akka.dispatch.Mailboxes;
import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.util.Timeout;
import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.util.Timeout;
InvalidActorNameException lastEx = null;
for (int i = 0; i < 10; i++) {
try {
InvalidActorNameException lastEx = null;
for (int i = 0; i < 10; i++) {
try {
- return factory.createTestActor(builder.props().withDispatcher(Dispatchers.DefaultDispatcherId()), id);
+ return factory.createTestActor(builder.props().withDispatcher(Dispatchers.DefaultDispatcherId())
+ .withMailbox(Mailboxes.DefaultMailboxId()), id);
} catch (InvalidActorNameException e) {
lastEx = e;
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} catch (InvalidActorNameException e) {
lastEx = e;
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.Status;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.Status;
+import akka.dispatch.ControlMessage;
import akka.dispatch.Dispatchers;
import akka.dispatch.Dispatchers;
+import akka.dispatch.Mailboxes;
import akka.pattern.Patterns;
import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.pattern.Patterns;
import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
CountDownLatch behaviorStateChangeLatch;
public static Props props() {
CountDownLatch behaviorStateChangeLatch;
public static Props props() {
- return Props.create(MemberActor.class).withDispatcher(Dispatchers.DefaultDispatcherId());
+ return Props.create(MemberActor.class).withDispatcher(Dispatchers.DefaultDispatcherId())
+ .withMailbox(Mailboxes.DefaultMailboxId());
- static class SendImmediateHeartBeat {
+ static class SendImmediateHeartBeat implements ControlMessage {
public static final SendImmediateHeartBeat INSTANCE = new SendImmediateHeartBeat();
private SendImmediateHeartBeat() {
}
}
public static final SendImmediateHeartBeat INSTANCE = new SendImmediateHeartBeat();
private SendImmediateHeartBeat() {
}
}
- static class GetBehaviorState {
+ static class GetBehaviorState implements ControlMessage {
public static final GetBehaviorState INSTANCE = new GetBehaviorState();
private GetBehaviorState() {
}
}
public static final GetBehaviorState INSTANCE = new GetBehaviorState();
private GetBehaviorState() {
}
}
- static class SetBehavior {
+ static class SetBehavior implements ControlMessage {
RaftActorBehavior behavior;
MockRaftActorContext context;
RaftActorBehavior behavior;
MockRaftActorContext context;
# enable to test serialization only.
serialize-messages = off
# enable to test serialization only.
serialize-messages = off
- serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
- }
-
- serialization-bindings {
- "org.opendaylight.controller.cluster.common.actor.Monitor" = java
- "org.opendaylight.controller.cluster.raft.client.messages.FindLeader" = java
- "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
- "com.google.protobuf.Message" = proto
- "com.google.protobuf.GeneratedMessage" = proto
+ default-mailbox {
+ mailbox-type="org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+
+ # We use a ControlAwareMailbox so that raft messages that implement ControlMessage
+ # are given higher priority.
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
loglevel = "INFO"
loggers = ["akka.event.slf4j.Slf4jLogger"]
akka {
loglevel = "INFO"
loggers = ["akka.event.slf4j.Slf4jLogger"]
-}
\ No newline at end of file
loggers = ["akka.testkit.TestEventListener", "akka.event.slf4j.Slf4jLogger"]
actor {
loggers = ["akka.testkit.TestEventListener", "akka.event.slf4j.Slf4jLogger"]
actor {
- serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
- }
-
- serialization-bindings {
- "org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification" = java
- "com.google.protobuf.Message" = proto
-
- }
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}
+ shard-dispatcher {
+ type = Dispatcher
+ executor = "default-executor"
+ mailbox-type = "org.opendaylight.controller.cluster.common.actor.UnboundedDequeBasedControlAwareMailbox"
+ }
+
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
provider = "akka.cluster.ClusterActorRefProvider"
serializers {
- java = "akka.serialization.JavaSerializer"
- proto = "akka.remote.serialization.ProtobufSerializer"
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
}
serialization-bindings {
- "com.google.protobuf.Message" = proto
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}
"org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
}
}