You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by GitBox <gi...@apache.org> on 2022/02/22 14:15:58 UTC

[GitHub] [sling-org-apache-sling-distribution-journal] joerghoh commented on a change in pull request #63: SLING-10107 [Refactoring] improve resourceresolver handling

joerghoh commented on a change in pull request #63:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/63#discussion_r811991897



##########
File path: src/main/java/org/apache/sling/distribution/journal/bookkeeper/BookKeeper.java
##########
@@ -113,16 +117,33 @@ public BookKeeper(
         this.config = config;
         String nameRetries = DistributionMetricsService.SUB_COMPONENT + ".current_retries;sub_name=" + config.getSubAgentName();
         this.retriesGauge = distributionMetricsService.createGauge(nameRetries, "Retries of current package", packageRetries::getSum);
+
+        this.resolversOpenedGauge = distributionMetricsService
+                .createGauge(DistributionMetricsService.SUB_COMPONENT + ".openedResolvers;sub_name=" + config.getSubAgentName(),
+                 "number of opened ResourceResolvers for this bookkeeper", resolverOpenCounter::get);
         this.resolverFactory = resolverFactory;
         this.distributionMetricsService = distributionMetricsService;
         // Error queues are enabled when the number
         // of retry attempts is limited ; disabled otherwise
         this.errorQueueEnabled = (config.getMaxRetries() >= 0);
-        this.statusStore = new LocalStore(resolverFactory, STORE_TYPE_STATUS, config.getSubAgentName());
-        this.processedOffsets = new LocalStore(resolverFactory, STORE_TYPE_PACKAGE, config.getSubAgentName());
+        this.statusStore = new LocalStore(bookKeeperResolver, STORE_TYPE_STATUS, config.getSubAgentName());

Review comment:
       What's the lifetime of a bookkeeper object? If it's a long-living object, these ```ResourceResolver```s are also long-living, which is a anti-pattern in Sling/JCR.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org