ionutzpi commented on code in PR #43: URL: https://github.com/apache/sling-org-apache-sling-event/pull/43#discussion_r2087449043
########## src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java: ########## @@ -199,6 +202,50 @@ static JobManagerConfiguration newForTest(ResourceResolverFactory resourceResolv /** The topology capabilities. */ private volatile TopologyCapabilities topologyCapabilities; + /** The condition that determines if job processing is enabled. */ + @Reference( + target = "(osgi.condition.id=org.apache.sling.event.jobs.processing.enabled)", + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + policyOption = ReferencePolicyOption.GREEDY + ) + private volatile Condition jobProcessingEnabledCondition; + + /** + * Handle binding of the job processing condition. + * @param condition The condition being bound + */ + protected void bindJobProcessingEnabledCondition(final Condition condition) { + this.jobProcessingEnabledCondition = condition; + // If condition becomes true, trigger maintenance to start processing jobs + if (condition != null) { + notifyListeners(); + } + } + + /** + * Handle unbinding of the job processing condition. + * @param condition The condition being unbound + */ + protected void unbindJobProcessingEnabledCondition(final Condition condition) { + if (this.jobProcessingEnabledCondition == condition) { + this.jobProcessingEnabledCondition = null; Review Comment: Made it to be set only once. Its safer this way. ########## src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java: ########## @@ -122,8 +122,8 @@ public class JobManagerImpl @Reference private StatisticsManager statisticsManager; - - + + Review Comment: Done. ########## src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java: ########## @@ -95,7 +95,7 @@ }) public class JobManagerImpl implements JobManager, EventHandler, Runnable { - + Review Comment: Done. -- 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-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org