Source:
<code>public Pair<PollingResult, Exception> pollWithTimeout(StatusCheckerTask<T> statusCheckerTask, T t, long interval, TimeoutChecker timeoutChecker, int maxConsecutiveFailures) { boolean success = false; boolean timeout = false; int attempts = 0; int consecutiveFailures = 0; Exception actual = null; boolean exit = statusCheckerTask.exitPolling(t); while (!timeout && !exit) { LOGGER.debug("Polling attempt {}.", attempts); try { success = statusCheckerTask.checkStatus(t); } catch (Exception ex) { consecutiveFailures++; actual = ex; LOGGER.debug("Exception occurred in the polling: {}. Number of consecutive failures: [{}/{}]", ex.getMessage(), consecutiveFailures, maxConsecutiveFailures, ex); } if (consecutiveFailures >= maxConsecutiveFailures) { LOGGER.debug("Polling failure reached the limit which was {}, poller will drop the last exception.", maxConsecutiveFailures); statusCheckerTask.handleException(actual); return new ImmutablePair<>(PollingResult.FAILURE, actual); } else if (success) { LOGGER.debug(statusCheckerTask.successMessage(t)); <START> LOGGER.debug("Set the number of consecutive failures to 0, since we resived a positve answer. Original number of consecutiveFailures: {}", <END> consecutiveFailures); consecutiveFailures = 0; return new ImmutablePair<>(PollingResult.SUCCESS, actual); } sleep(interval); attempts++; timeout = timeoutChecker.checkTimeout(); exit = statusCheckerTask.exitPolling(t); } if (timeout) { LOGGER.debug("Poller timeout."); statusCheckerTask.handleTimeout(t); return new ImmutablePair<>(PollingResult.TIMEOUT, actual); } LOGGER.debug("Poller exiting."); return new ImmutablePair<>(PollingResult.EXIT, actual); }</code><technical_language>typo: resived -> received</technical_language>

Target:
public Pair<PollingResult, Exception> pollWithTimeout(StatusCheckerTask<T> statusCheckerTask, T t, long interval, TimeoutChecker timeoutChecker, int maxConsecutiveFailures) { boolean success = false; boolean timeout = false; int attempts = 0; int consecutiveFailures = 0; Exception actual = null; boolean exit = statusCheckerTask.exitPolling(t); while (!timeout && !exit) { LOGGER.debug("Polling attempt {}.", attempts); try { success = statusCheckerTask.checkStatus(t); } catch (Exception ex) { consecutiveFailures++; actual = ex; LOGGER.debug("Exception occurred in the polling: {}. Number of consecutive failures: [{}/{}]", ex.getMessage(), consecutiveFailures, maxConsecutiveFailures, ex); } if (consecutiveFailures >= maxConsecutiveFailures) { LOGGER.debug("Polling failure reached the limit which was {}, poller will drop the last exception.", maxConsecutiveFailures); statusCheckerTask.handleException(actual); return new ImmutablePair<>(PollingResult.FAILURE, actual); } else if (success) { LOGGER.debug(statusCheckerTask.successMessage(t)); LOGGER.debug("Set the number of consecutive failures to 0, since we received a positve answer. Original number of consecutiveFailures: {}", consecutiveFailures); consecutiveFailures = 0; return new ImmutablePair<>(PollingResult.SUCCESS, actual); } sleep(interval); attempts++; timeout = timeoutChecker.checkTimeout(); exit = statusCheckerTask.exitPolling(t); } if (timeout) { LOGGER.debug("Poller timeout."); statusCheckerTask.handleTimeout(t); return new ImmutablePair<>(PollingResult.TIMEOUT, actual); } LOGGER.debug("Poller exiting."); return new ImmutablePair<>(PollingResult.EXIT, actual); }