- protected RaftActorBehavior internalSwitchBehavior(RaftActorBehavior newBehavior) {
- LOG.info("{} :- Switching from behavior {} to {}", logName(), this.state(), newBehavior.state());
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ protected RaftActorBehavior internalSwitchBehavior(final RaftActorBehavior newBehavior) {
+ if (!context.getRaftPolicy().automaticElectionsEnabled()) {
+ return this;
+ }
+
+ log.info("{} :- Switching from behavior {} to {}, election term: {}", logName(), this.state(),
+ newBehavior.state(), context.getTermInformation().getCurrentTerm());