You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Dave Bryson <da...@miceda-data.com> on 2001/03/06 05:22:41 UTC
Fwd: Turbine - Schedule - JobQueue class bug
Hi everyone,
This e-mail was sent to me regarding a small change to the Scheduler Service.
Since i haven't used the Service in some time and I know others have, i wanted
to forward this to the group so those interested in the service could review
it.
It looks reasonable to me but I wanted to be sure before changing things.
Thanks,
Dave
---------- Forwarded Message ----------
Subject: Turbine - Schedule - JobQueue class bug
Date: Sun, 04 Mar 2001 20:18:29
From: "Michael Gray" <ms...@hotmail.com>
Hello,
I was testing out the job scheduling component when I came accross the
following bug in the JobQueue class:
Currently the code is:
public int compare(Object je1, Object je2)
{
return (int)( ((JobEntry)je1).getNextRuntime() -
((JobEntry)je2).getNextRuntime() );
}
However, since getNextRuntime() returns a long there is a potential that the
int is not large enough to hold the value that compare() returns. I believe
if the difference between the two jobs is greater than 24 days or so, the
int will overflow.
I changed the code (locally) to the following and it seems to eliminate the
problem:
public int compare(Object obj1, Object obj2)
{
long obj1Time = ((JobEntry)obj1).getNextRuntime();
long obj2Time = ((JobEntry)obj2).getNextRuntime();
if (obj1Time > obj2Time)
return 1;
else if (obj1Time < obj2Time)
return -1;
else
return 0;
}
Otherwise the scheduler seems to work very well.
Best regards,
Michael Gray
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
-------------------------------------------------------
--
Dave Bryson
daveb@miceda-data.com
----------------------