use of akka.persistence.RecoveryCompleted in project controller by opendaylight.
the class RecoveringClientActorBehavior method onReceiveRecover.
@Override
AbstractClientActorBehavior<?> onReceiveRecover(final Object recover) {
if (recover instanceof RecoveryCompleted) {
final ClientIdentifier nextId;
if (lastId != null) {
if (!currentFrontend.equals(lastId.getFrontendId())) {
LOG.error("{}: Mismatched frontend identifier, shutting down. Current: {} Saved: {}", persistenceId(), currentFrontend, lastId.getFrontendId());
return null;
}
nextId = ClientIdentifier.create(currentFrontend, lastId.getGeneration() + 1);
} else {
nextId = ClientIdentifier.create(currentFrontend, 0);
}
LOG.debug("{}: persisting new identifier {}", persistenceId(), nextId);
context().saveSnapshot(nextId);
return new SavingClientActorBehavior(context(), nextId);
} else if (recover instanceof SnapshotOffer) {
lastId = (ClientIdentifier) ((SnapshotOffer) recover).snapshot();
LOG.debug("{}: recovered identifier {}", persistenceId(), lastId);
} else {
LOG.warn("{}: ignoring recovery message {}", persistenceId(), recover);
}
return this;
}
Aggregations