- protected RaftActorBehavior switchBehavior(RaftActorBehavior behavior) {
- LOG.info("{} :- Switching from behavior {} to {}", context.getId(), this.state(), behavior.state());
+ @Override
+ public short getLeaderPayloadVersion() {
+ return leaderPayloadVersion;
+ }
+
+ public void setLeaderPayloadVersion(short leaderPayloadVersion) {
+ this.leaderPayloadVersion = leaderPayloadVersion;
+ }
+
+ @Override
+ public RaftActorBehavior switchBehavior(RaftActorBehavior behavior) {
+ return internalSwitchBehavior(behavior);
+ }
+
+ protected RaftActorBehavior internalSwitchBehavior(RaftState newState) {
+ if(context.getRaftPolicy().automaticElectionsEnabled()){
+ return internalSwitchBehavior(newState.createBehavior(context));
+ }
+ return this;
+ }
+
+ private RaftActorBehavior internalSwitchBehavior(RaftActorBehavior newBehavior) {
+ LOG.info("{} :- Switching from behavior {} to {}", logName(), this.state(), newBehavior.state());