private void onCardinality() {
      recoveryRetransmitter.stop();
      recoveryRetransmitter = null;

      if (answerFromLeader == null) {
        Recovery recovery = new Recovery(-1, localEpochNumber);
        recoveryRetransmitter = retransmitter.startTransmitting(recovery);
      } else {
        startCatchup((int) answerFromLeader.getNextId());
        Network.removeMessageListener(MessageType.RecoveryAnswer, this);
      }
    }
  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));
  }
 private void onRecoveryFinished() {
   fireRecoveryListener();
   Network.addMessageListener(MessageType.Recovery, new EpochRecoveryRequestHandler(paxos));
 }