cschneider commented on code in PR #184:
URL:
https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/184#discussion_r2924445360
##########
src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueProviderImpl.java:
##########
@@ -77,13 +82,24 @@ public class PubQueueProviderImpl implements
PubQueueProvider, Runnable {
*/
private final Map<String, OffsetQueue<Long>> errorQueues = new
ConcurrentHashMap<>();
+ private final Map<String, Integer> cachedQueueSizes = new
ConcurrentHashMap<>();
+
+ private final ScheduledExecutorService queueSizeExecutor;
+
private ServiceRegistration<?> reg;
public PubQueueProviderImpl(EventAdmin eventAdmin, QueueErrors
queueErrors, CacheCallback callback, BundleContext context) {
queuedNotifier = new PackageQueuedNotifier(eventAdmin);
this.queueErrors = queueErrors;
this.callback = callback;
cache = newCache();
+ queueSizeExecutor = Executors.newSingleThreadScheduledExecutor(r -> {
+ Thread t = new Thread(r, "queue-size-refresh");
+ t.setDaemon(true);
+ return t;
+ });
+ queueSizeExecutor.scheduleAtFixedRate(this::refreshQueueSizes,
+ QUEUE_SIZE_REFRESH_SECONDS, QUEUE_SIZE_REFRESH_SECONDS,
TimeUnit.SECONDS);
Review Comment:
This is just for the metric. I don't think we need to change this.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]