public EpochSSRecovery(SnapshotProvider snapshotProvider, String logPath) throws IOException { epochFile = new SingleNumberWriter(logPath, EPOCH_FILE_NAME); localId = ProcessDescriptor.getInstance().localId; numReplicas = ProcessDescriptor.getInstance().numReplicas; storage = createStorage(); paxos = createPaxos(snapshotProvider, storage); dispatcher = paxos.getDispatcher(); }
// Get all instances before <code>nextId</code> private void startCatchup(final int nextId) { new RecoveryCatchUp(paxos.getCatchup(), storage) .recover( nextId, new Runnable() { public void run() { onRecoveryFinished(); } }); }
public void run() { // do not execute recovery mechanism on first run localEpochNumber = storage.getEpoch()[localId]; if (localEpochNumber == 1) { onRecoveryFinished(); return; } retransmitter = new ActiveRetransmitter(paxos.getNetwork()); logger.info("Sending recovery message"); Network.addMessageListener(MessageType.RecoveryAnswer, new RecoveryAnswerListener()); recoveryRetransmitter = retransmitter.startTransmitting(new Recovery(-1, localEpochNumber)); }