use of org.opendaylight.controller.cluster.raft.client.messages.GetSnapshotReply in project controller by opendaylight.
the class GetSnapshotReplyActor method onReceive.
@Override
public void onReceive(final Object message) {
if (message instanceof CaptureSnapshotReply) {
Snapshot snapshot = Snapshot.create(((CaptureSnapshotReply) message).getSnapshotState(), params.captureSnapshot.getUnAppliedEntries(), params.captureSnapshot.getLastIndex(), params.captureSnapshot.getLastTerm(), params.captureSnapshot.getLastAppliedIndex(), params.captureSnapshot.getLastAppliedTerm(), params.electionTerm.getCurrentTerm(), params.electionTerm.getVotedFor(), params.peerInformation);
LOG.debug("{}: Received CaptureSnapshotReply, sending {}", params.id, snapshot);
params.replyToActor.tell(new GetSnapshotReply(params.id, snapshot), getSelf());
getSelf().tell(PoisonPill.getInstance(), getSelf());
} else if (message instanceof ReceiveTimeout) {
LOG.warn("{}: Got ReceiveTimeout for inactivity - did not receive CaptureSnapshotReply within {} ms", params.id, params.receiveTimeout.toMillis());
params.replyToActor.tell(new akka.actor.Status.Failure(new TimeoutException(String.format("Timed out after %d ms while waiting for CaptureSnapshotReply", params.receiveTimeout.toMillis()))), getSelf());
getSelf().tell(PoisonPill.getInstance(), getSelf());
}
}
Aggregations