You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2022/02/07 11:53:26 UTC

[GitHub] [sling-org-apache-sling-event] joerghoh commented on a change in pull request #16: SLING-11091: expose the number of scheduled jobs as metric

joerghoh commented on a change in pull request #16:
URL: https://github.com/apache/sling-org-apache-sling-event/pull/16#discussion_r800580337



##########
File path: src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java
##########
@@ -455,6 +455,14 @@ private boolean match(final ScheduledJobInfoImpl job, final Map<String, Object>
         }
         return jobs;
     }
+    
+    /**
+     * Provide the total number of jobs registered in the system, irrespective of topics
+     * @return the total number of scheduled jobs
+     */
+    public int getTotalNumberOfScheduledJobs() {
+       return this.scheduledJobs.size(); 

Review comment:
       sure, to deliver precise results it would need synchronization. But this is "just" metrics, so not always 100% accurate would be totally ok.
   On the other hand I the overhead is probably very minor, because it is expected that this map does not change a lot.
   
   I will add this synchronization.




-- 
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: dev-unsubscribe@sling.apache.org

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