You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Anshika Agarwal (JIRA)" <ji...@apache.org> on 2014/06/26 07:24:24 UTC

[jira] [Created] (SLING-3701) [Job Scheduling] : No API to search through the scheduled jobs based on some properties.

Anshika Agarwal created SLING-3701:
--------------------------------------

             Summary: [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


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)