X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbehaviors%2FRaftActorBehavior.java;h=bf5116935d108c91ecec947cf7544ecc7f7cd3dc;hb=b8c6400766f7324dd57d059bd48e435569fe1a27;hp=d04dec030bbdcf65176e3f299b9da32597cc2ff8;hpb=81236f34ad88ffcb71c8d7cdb15b82bad2e50251;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java index d04dec030b..bf5116935d 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.raft.behaviors; import akka.actor.ActorRef; +import javax.annotation.Nullable; import org.opendaylight.controller.cluster.raft.RaftState; /** @@ -34,9 +35,9 @@ public interface RaftActorBehavior extends AutoCloseable{ * @param sender The sender of the message * @param message A message that needs to be processed * - * @return The new behavior or current behavior + * @return The new behavior or current behavior, or null if the message was not handled. */ - RaftActorBehavior handleMessage(ActorRef sender, Object message); + @Nullable RaftActorBehavior handleMessage(ActorRef sender, Object message); /** * @@ -65,4 +66,16 @@ public interface RaftActorBehavior extends AutoCloseable{ * @return the leader's payload data version. */ short getLeaderPayloadVersion(); + + /** + * switchBehavior makes sure that the current behavior is shutdown before it switches to the new + * behavior + * + * @param behavior The new behavior to switch to + * @return The new behavior + */ + RaftActorBehavior switchBehavior(RaftActorBehavior behavior); + + @Override + void close(); }