[ https://issues.apache.org/jira/browse/SLING-3701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler reassigned SLING-3701: --------------------------------------- Assignee: Carsten Ziegeler > [Job Scheduling] : No API to search through the scheduled jobs based on some > properties. > ---------------------------------------------------------------------------------------- > > Key: SLING-3701 > URL: https://issues.apache.org/jira/browse/SLING-3701 > Project: Sling > Issue Type: Improvement > Components: API > Reporter: Anshika Agarwal > Assignee: Carsten Ziegeler > Labels: scheduler, scheduling > Fix For: Event 3.3.12 > > > JobManager has the following API to search for jobs of jcr:primaryType as > "slingevent:Job": > Job getJob(String topic, Map<String, Object> template); > Collection<Job> findJobs(QueryType type, String topic, long limit, > Map<String, Object>... templates); > However, I am unable to find an API that will help me search through the > scheduled jobs that are of jcr:primaryType as "slingevent:TimedEvent" and are > scheduled to become slingevent:Job at a specific time in future. > Issue: > Since the above mentioned APIs do not return the scheduled jobs, we are left > with the option of retrieving ALL the scheduled jobs using > jobManager.getScheduledJobs(); > and then iterating through each of these jobs to find a particular desired > job. > Requirement: > An API providing search on scheduled jobs based on the event topic and > properties would be good. This is required to check if a replication job > already exists for a asset and if it does, it needs to be rescheduled. > Workaround: > Collection<ScheduledJobInfo> scheduledJobs = jobManager.getScheduledJobs(); > for (ScheduledJobInfo eachJob : scheduledJobs) { > if (criteria matches with eachJob) > { eachJob.reschedule(); } > } -- This message was sent by Atlassian JIRA (v6.2#6252)