This is an automated email from the ASF dual-hosted git repository. cschneider pushed a commit to branch SLING-8863 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git
commit 806271228ac88ac15dc2f90f7fb6f48b558600a3 Author: Christian Schneider <[email protected]> AuthorDate: Tue Nov 26 12:08:42 2019 +0100 SLING-8863 - Only trigger cicuit breaker once --- .../distribution/journal/impl/shared/JournalAvailableChecker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/journal/impl/shared/JournalAvailableChecker.java b/src/main/java/org/apache/sling/distribution/journal/impl/shared/JournalAvailableChecker.java index 18c7f5c..b2a3d6c 100644 --- a/src/main/java/org/apache/sling/distribution/journal/impl/shared/JournalAvailableChecker.java +++ b/src/main/java/org/apache/sling/distribution/journal/impl/shared/JournalAvailableChecker.java @@ -104,6 +104,7 @@ public class JournalAvailableChecker implements EventHandler { private void available() { LOG.info("Journal is available"); + this.numErrors.set(0); this.marker.register(); } @@ -136,10 +137,9 @@ public class JournalAvailableChecker implements EventHandler { public synchronized void handleEvent(Event event) { String type = (String) event.getProperty(ExceptionEventSender.KEY_TYPE); int curNumErrors = this.numErrors.incrementAndGet(); - if (curNumErrors >= MIN_ERRORS) { + if (curNumErrors == MIN_ERRORS) { LOG.warn("Received exception event {}. Journal is considered unavailable.", type); this.marker.unRegister(); - this.numErrors.set(0); this.backoffRetry.startChecks(); } else { LOG.info("Received exception event {}. {} of {} errors occurred.", type, curNumErrors, MIN_ERRORS);
