package org.opendaylight.controller.cluster.raft.behaviors;
import akka.actor.ActorRef;
+import javax.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.RaftState;
/**
* @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);
/**
*
* @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();
}