]
Toshiya Kobayashi resolved JBAS-8382.
-------------------------------------
Fix Version/s: 6.0.0.CR1
Resolution: Done
Use long instead of int.
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
Fix For: 6.0.0.CR1
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: