+
+ @Override
+ String getLastLeaderId() {
+ return null;
+ }
+ };
+
+ private String lastValidLeaderId;
+ private String lastLeaderId;
+
+ BehaviorState capture(final RaftActorBehavior behavior) {
+ if (behavior == null) {
+ Verify.verify(lastValidLeaderId == null, "Null behavior with non-null last leader");
+ return NULL_BEHAVIOR_STATE;
+ }
+
+ lastLeaderId = behavior.getLeaderId();
+ if (lastLeaderId != null) {
+ lastValidLeaderId = lastLeaderId;
+ }
+
+ return new SimpleBehaviorState(lastValidLeaderId, lastLeaderId, behavior);