You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2015/02/20 11:24:11 UTC

[jira] [Commented] (TAP5-2455) One-off and past CronSchedule jobs never get ended in PeriodicExecutor

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

ASF subversion and git services commented on TAP5-2455:
-------------------------------------------------------

Commit 847403b0ea0f508ba90604dea13720942416bc32 in tapestry-5's branch refs/heads/master from [~jkemnade]
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=847403b ]

TAP5-2455: if a job doesn't have a valid next execution time, un-schedule it


> 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
>         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)