This is an automated email from the ASF dual-hosted git repository.
tmaret pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git
The following commit(s) were added to refs/heads/master by this push:
new 3005671 SLING-8863 - Only trigger circuit breaker once (#15)
3005671 is described below
commit 3005671267e935577fd19d544480e9b04a33f9b2
Author: Christian Schneider <[email protected]>
AuthorDate: Tue Nov 26 22:39:02 2019 +0100
SLING-8863 - Only trigger circuit breaker once (#15)
SLING-8863 - Only trigger cicuit breaker once
* start with closed circuit breaker
* start with closed circuit breaker
---
.../distribution/journal/impl/shared/JournalAvailableChecker.java | 8 ++++----
1 file changed, 4 insertions(+), 4 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..eb878b2 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
@@ -82,9 +82,9 @@ public class JournalAvailableChecker implements EventHandler {
requireNonNull(provider);
requireNonNull(topics);
this.marker = new JournalAvailableServiceMarker(context);
- this.backoffRetry.startChecks();
this.gauge =
metrics.createGauge(DistributionMetricsService.BASE_COMPONENT +
".journal_available", "", this::isAvailable);
- LOG.info("Started Journal availability checker service");
+ this.marker.register();
+ LOG.info("Started Journal availability checker service. Journal is
initially assumed available.");
}
@Deactivate
@@ -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);