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/25 16:05:25 UTC

[jira] [Updated] (SLING-3699) [Job Scheduling] A job scheduled using JobBuilder does not get removed if the JobConsumer returns JobResult.OK

     [ https://issues.apache.org/jira/browse/SLING-3699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anshika Agarwal updated SLING-3699:
-----------------------------------

    Description: 
Behavior:

If we schedule a job to be executed at a specific time for a topic using:
JobBuilder jobBuilder = jobManager.createJob(EVENT_TOPIC);	
jobBuilder.properties(props).schedule().at(activationTime).add();

It first creates a node of type "slingevent:TimedEvent" in crx repository under "/var/eventing/scheduled-jobs" and when the exact time arrives (in this case activationTime), a node of type "slingevent:Job" gets created under assigned jobs and posts an event to the JobConsumer.

Issue:

When the JobConsumer returns JobResult.OK the node of type "slingevent:TimedEvent" (scheduled job) does not get removed from the list.
Due to this issue, when the server restarts, all the jobs that were earlier scheduled and had finished with their execution, get executed again to become nodes of type "slingevent:Job" and again post an event to the JobConsumer. This happens for all the jobs scheduled for a time that is before the current time (when the server restarts)

Desired:

Although, we wish to have the scheduled jobs to persist even after the server restarts, but only the jobs that have not yet been executed should be executed after restart. This implies that all the jobs that are executed should be removed from the list of scheduled jobs once the JobConsumer returns JobResult.OK

  was:
Behavior:
If we schedule a job to be executed at a specific time for a topic using:

JobBuilder jobBuilder = jobManager.createJob(EVENT_TOPIC);							jobBuilder..properties(props).schedule().at(activationTime).add();

It first creates a node of type "slingevent:TimedEvent" in crx repository under "/var/eventing/scheduled-jobs" and when the exact time arrives (in this case activationTime), a node of type "slingevent:Job" gets created under assigned jobs and posts an event to the JobConsumer.

Issue:
When the JobConsumer returns JobResult.OK the node of type "slingevent:TimedEvent" (scheduled job) does not get removed from the list.

Due to this issue, when the server restarts, all the jobs that were earlier scheduled and had finished with their execution, get executed again to become nodes of type "slingevent:Job" and again post an event to the JobConsumer. This happens for all the jobs scheduled for a time that is before the current time (when the server restarts)

Desired:
Although, we wish to have the scheduled jobs to persist even after the server restarts, but only the jobs that have not yet been executed should be executed after restart. This implies that all the jobs that are executed should be removed from the list of scheduled jobs once the JobConsumer returns JobResult.OK


> [Job Scheduling] A job scheduled using JobBuilder does not get removed if the JobConsumer returns JobResult.OK
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-3699
>                 URL: https://issues.apache.org/jira/browse/SLING-3699
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>            Reporter: Anshika Agarwal
>            Priority: Critical
>              Labels: scheduler, scheduling
>
> Behavior:
> If we schedule a job to be executed at a specific time for a topic using:
> JobBuilder jobBuilder = jobManager.createJob(EVENT_TOPIC);	
> jobBuilder.properties(props).schedule().at(activationTime).add();
> It first creates a node of type "slingevent:TimedEvent" in crx repository under "/var/eventing/scheduled-jobs" and when the exact time arrives (in this case activationTime), a node of type "slingevent:Job" gets created under assigned jobs and posts an event to the JobConsumer.
> Issue:
> When the JobConsumer returns JobResult.OK the node of type "slingevent:TimedEvent" (scheduled job) does not get removed from the list.
> Due to this issue, when the server restarts, all the jobs that were earlier scheduled and had finished with their execution, get executed again to become nodes of type "slingevent:Job" and again post an event to the JobConsumer. This happens for all the jobs scheduled for a time that is before the current time (when the server restarts)
> Desired:
> Although, we wish to have the scheduled jobs to persist even after the server restarts, but only the jobs that have not yet been executed should be executed after restart. This implies that all the jobs that are executed should be removed from the list of scheduled jobs once the JobConsumer returns JobResult.OK



--
This message was sent by Atlassian JIRA
(v6.2#6252)