[jboss-jira] [JBoss JIRA] Assigned: (JBAS-8382) ScheduleManager's skip repeats can be negative

Toshiya Kobayashi (JIRA) jira-events at lists.jboss.org
Sat Sep 11 11:20:19 EDT 2010


     [ https://jira.jboss.org/browse/JBAS-8382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Toshiya Kobayashi reassigned JBAS-8382:
---------------------------------------

    Assignee: Toshiya Kobayashi  (was: Dimitris Andreadis)


> ScheduleManager's skip repeats can be negative
> ----------------------------------------------
>
>                 Key: JBAS-8382
>                 URL: https://jira.jboss.org/browse/JBAS-8382
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Scheduling/Timers
>    Affects Versions: JBossAS-4.2.3.GA, JBossAS-5.1.0.GA, 6.0.0.M4
>            Reporter: Toshiya Kobayashi
>            Assignee: Toshiya Kobayashi
>
> If you use org.jboss.varia.scheduler.ScheduleManager with short 'period' (say, '1' ms), result of skip repeats calculation can be negative and it causes wrong repetition.
> The cause is casting long to int.
>       public void start() throws JMException
>       {
>          Date lStartDate = null;
>          // Check if initial start date is in the past
>          if (mStartDate.getTime() < new Date().getTime() && mPeriod > 0)
>          {
>             // If then first check if a repetition is in the future
>             long lNow = new Date().getTime() + 100;
>             int lSkipRepeats = (int) ((lNow - mStartDate.getTime()) / mPeriod) + 1;
>             log.debug("Old start date: " + mStartDate + ", now: " + new Date(lNow) + ", Skip repeats: " + lSkipRepeats)
> BTW, org.jboss.varia.scheduler.Scheduler properly casts it to long.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list