tmaret commented on a change in pull request #8: SLING-8531 - Exponential 
backoff for retries
URL: 
https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/8#discussion_r301982088
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/distribution/journal/impl/shared/JournalAvailableChecker.java
 ##########
 @@ -60,26 +63,33 @@
     
     @Reference
     DistributionMetricsService metrics;
-
+    
     private BundleContext context;
 
     private volatile ServiceRegistration<JournalAvailable> reg;
 
     private GaugeService<Boolean> gauge;
 
+    private ExponentialBackOff backoffRetry;
+    
+    private AtomicInteger numErrors;
+    
     @Activate
     public void activate(BundleContext context) {
         requireNonNull(provider);
         requireNonNull(topics);
         this.context = context;
+        this.numErrors = new AtomicInteger();
         gauge = metrics.createGauge(DistributionMetricsService.BASE_COMPONENT 
+ ".journal_available", "", this::isAvailable);
         LOG.info("Started Journal availability checker service");
+        startChecks();
 
 Review comment:
   We may avoid scheduling a check from the activate method as the logic 
attempts to connect to the Journal right away anyway. It'd simplify the 
synchronisation as there would be no possibility for concurrent `startCheck` 
invocation (from activate and from events).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to