*/
protected abstract void applySnapshot(Object snapshot);
+ /**
+ * This method will be called by the RaftActor when the state of the
+ * RaftActor changes. The derived actor can then use methods like
+ * isLeader or getLeader to do something useful
+ */
+ protected abstract void onStateChanged();
+
private RaftActorBehavior switchBehavior(RaftState state) {
if (currentBehavior != null) {
if (currentBehavior.state() == state) {
} else {
behavior = new Leader(context);
}
+
+ onStateChanged();
+
return behavior;
}