You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Konrad Windszus <ko...@gmx.de> on 2016/08/18 08:47:06 UTC

Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

How does the Sling Scheduler behave in case two jobs are scheduled with a cron expression (one at 1am, one at 2am on a daily basis) and Sling is either not running or the computer is in sleep mode at that time?
Will both be executed immediately when the Sling Scheduler is active again? 
What about the order of both Jobs? Is the one with the earlier cron expression always being executed first?
Thanks for clarification.
Konrad


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Konrad Windszus <ko...@gmx.de>.
I created https://issues.apache.org/jira/browse/SLING-5974 for making it possible to configure the misfire behaviour through the Sling Scheduler API.

> On 18 Aug 2016, at 11:12, Konrad Windszus <ko...@gmx.de> wrote:
> 
> The default behaviour of Quartz seems to be a different one:
> https://dzone.com/articles/quartz-scheduler-misfire <https://dzone.com/articles/quartz-scheduler-misfire>
> 
> MISFIRE_INSTRUCTION_FIRE_ONCE_NOW, which means a misfired execution (e.g. a missed cron time) leads to the immediate execution of that job once the Scheduler is running again.
> Maybe that should be clarified in the Javadoc of the Scheduler itself.
> 
> Konrad
> 
> 
>> On 18 Aug 2016, at 10:59, Konrad Windszus <ko...@gmx.de> wrote:
>> 
>> This is not what I experience (I only tried with AEM 6.1 SP2 where maintenance tasks are executed with a scheduler). The jobs are executed immediately after the computer is waking up even if that is hours after the scheduled time.
>> 
>>> On 18 Aug 2016, at 10:55, Carsten Ziegeler <cz...@apache.org> wrote:
>>> 
>>>> How does the Sling Scheduler behave in case two jobs are scheduled with a cron expression (one at 1am, one at 2am on a daily basis) and Sling is either not running or the computer is in sleep mode at that time?
>>>> Will both be executed immediately when the Sling Scheduler is active again? 
>>>> What about the order of both Jobs? Is the one with the earlier cron expression always being executed first?
>>> 
>>> We're using the quartz library for this, and if Sling is not running at
>>> those times, then these jobs will be scheduled for the next day. It's
>>> like adding a cron job to your computer. If your computer is off at the
>>> scheduled time, the job does not run
>>> 
>>> Carsten
>>> 
>>> 
>>> 
>>> -- 
>>> Carsten Ziegeler
>>> Adobe Research Switzerland
>>> cziegeler@apache.org
>>> 
>> 
> 


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Konrad Windszus <ko...@gmx.de>.
The default behaviour of Quartz seems to be a different one:
https://dzone.com/articles/quartz-scheduler-misfire <https://dzone.com/articles/quartz-scheduler-misfire>

MISFIRE_INSTRUCTION_FIRE_ONCE_NOW, which means a misfired execution (e.g. a missed cron time) leads to the immediate execution of that job once the Scheduler is running again.
Maybe that should be clarified in the Javadoc of the Scheduler itself.

Konrad


> On 18 Aug 2016, at 10:59, Konrad Windszus <ko...@gmx.de> wrote:
> 
> This is not what I experience (I only tried with AEM 6.1 SP2 where maintenance tasks are executed with a scheduler). The jobs are executed immediately after the computer is waking up even if that is hours after the scheduled time.
> 
>> On 18 Aug 2016, at 10:55, Carsten Ziegeler <cz...@apache.org> wrote:
>> 
>>> How does the Sling Scheduler behave in case two jobs are scheduled with a cron expression (one at 1am, one at 2am on a daily basis) and Sling is either not running or the computer is in sleep mode at that time?
>>> Will both be executed immediately when the Sling Scheduler is active again? 
>>> What about the order of both Jobs? Is the one with the earlier cron expression always being executed first?
>> 
>> We're using the quartz library for this, and if Sling is not running at
>> those times, then these jobs will be scheduled for the next day. It's
>> like adding a cron job to your computer. If your computer is off at the
>> scheduled time, the job does not run
>> 
>> Carsten
>> 
>> 
>> 
>> -- 
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
>> 
> 


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Konrad Windszus <ko...@gmx.de>.
Hmm, I tend to disagree here. I dug deep into the code and com.adobe.granite.maintenance.impl.TaskSchedulerImpl is internally relying on org.apache.sling.commons.scheduler.Scheduler.
Konrad


> On 18 Aug 2016, at 11:11, Carsten Ziegeler <cz...@apache.org> wrote:
> 
>> This is not what I experience (I only tried with AEM 6.1 SP2 where maintenance tasks are executed with a scheduler). The jobs are executed immediately after the computer is waking up even if that is hours after the scheduled time.
>> 
> Maintenance tasks is an AEM feature which is not using the scheduler
> 
> Carsten
> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
> 


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Carsten Ziegeler <cz...@apache.org>.
> This is not what I experience (I only tried with AEM 6.1 SP2 where maintenance tasks are executed with a scheduler). The jobs are executed immediately after the computer is waking up even if that is hours after the scheduled time.
> 
Maintenance tasks is an AEM feature which is not using the scheduler

Carsten


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Konrad Windszus <ko...@gmx.de>.
This is not what I experience (I only tried with AEM 6.1 SP2 where maintenance tasks are executed with a scheduler). The jobs are executed immediately after the computer is waking up even if that is hours after the scheduled time.

> On 18 Aug 2016, at 10:55, Carsten Ziegeler <cz...@apache.org> wrote:
> 
>> How does the Sling Scheduler behave in case two jobs are scheduled with a cron expression (one at 1am, one at 2am on a daily basis) and Sling is either not running or the computer is in sleep mode at that time?
>> Will both be executed immediately when the Sling Scheduler is active again? 
>> What about the order of both Jobs? Is the one with the earlier cron expression always being executed first?
> 
> We're using the quartz library for this, and if Sling is not running at
> those times, then these jobs will be scheduled for the next day. It's
> like adding a cron job to your computer. If your computer is off at the
> scheduled time, the job does not run
> 
> Carsten
> 
> 
> 
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
> 


Re: Scheduler behaviour in case it is not running at the time where a job was supposed to be executed

Posted by Carsten Ziegeler <cz...@apache.org>.
> How does the Sling Scheduler behave in case two jobs are scheduled with a cron expression (one at 1am, one at 2am on a daily basis) and Sling is either not running or the computer is in sleep mode at that time?
> Will both be executed immediately when the Sling Scheduler is active again? 
> What about the order of both Jobs? Is the one with the earlier cron expression always being executed first?

We're using the quartz library for this, and if Sling is not running at
those times, then these jobs will be scheduled for the next day. It's
like adding a cron job to your computer. If your computer is off at the
scheduled time, the job does not run

Carsten

 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org