[ 
https://issues.apache.org/jira/browse/TAP5-2455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14328804#comment-14328804
 ] 

Hudson commented on TAP5-2455:
------------------------------

SUCCESS: Integrated in tapestry-trunk-freestyle #1388 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1388/])
TAP5-2455: if a job doesn't have a valid next execution time, un-schedule it 
(jochen.kemnade: rev 847403b0ea0f508ba90604dea13720942416bc32)
* 
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/cron/PeriodicExecutorImpl.java
* tapestry-ioc/src/test/groovy/ioc/specs/PeriodicExecutorSpec.groovy
* 
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/cron/Schedule.java


> One-off and past CronSchedule jobs never get ended in PeriodicExecutor
> ----------------------------------------------------------------------
>
>                 Key: TAP5-2455
>                 URL: https://issues.apache.org/jira/browse/TAP5-2455
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.4
>            Reporter: Mark Mearing-Smith
>            Assignee: Jochen Kemnade
>              Labels: patch
>             Fix For: 5.4
>
>         Attachments: 
> 0001-Fixed-PeriodicExecutorImpl-problem-when-next-executi.patch
>
>
> If you add a job with a CronSchedule that is to be run at only one time to 
> the PeriodicExecutor, it will never stop executing. It also happens if you 
> add one in the past:
> The code below will run indefinitely now even though the cron was scheduled 
> to run at midnight 1-Jan-2014:
> {code}
> periodicExecutor.addJob(
>     new CronSchedule("0 0 0 1 1 ? 2014"), "Test",
>     new Runnable() {
>         @Override
>         public void run() {
>             System.out.println("Testing the run");
>         }
>     }
> );
> {code}
> The problem is CronSchedule.nextExecution() returns 0 if there is no valid 
> date in the future. This then leads PeriodicExecutorImpl to sleep for 0 
> seconds between runs.
> My suggestion is around line 370 to do something like:
> {code}
> if (jobNextExecution == 0) {
>     job.cancel();
> } else if (jobNextExecution <= now) {
> {code}
> .....



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to