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

Toshiya Kobayashi (JIRA) jira-events at lists.jboss.org
Thu Sep 2 08:20:52 EDT 2010


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: 6.0.0.M4, JBossAS-5.1.0.GA, JBossAS-4.2.3.GA
            Reporter: Toshiya Kobayashi
            Assignee: Dimitris Andreadis


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