You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by db...@apache.org on 2001/03/08 03:45:47 UTC
cvs commit: jakarta-turbine/src/java/org/apache/turbine/services/schedule JobQueue.java
dbryson 01/03/07 18:45:47
Modified: src/java/org/apache/turbine/services/schedule JobQueue.java
Log:
Updated compare with patch submitted by: Michael Gray.
Thanks Michael!
This prevents the possibilty of overflowing the int value.
Revision Changes Path
1.5 +10 -3 jakarta-turbine/src/java/org/apache/turbine/services/schedule/JobQueue.java
Index: JobQueue.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/schedule/JobQueue.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JobQueue.java 2001/03/06 06:12:43 1.4
+++ JobQueue.java 2001/03/08 02:45:45 1.5
@@ -69,7 +69,7 @@
* Queue for the scheduler.
*
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
- * @version $Id: JobQueue.java,v 1.4 2001/03/06 06:12:43 chrise Exp $
+ * @version $Id: JobQueue.java,v 1.5 2001/03/08 02:45:45 dbryson Exp $
*/
public class JobQueue
implements Comparable
@@ -239,7 +239,14 @@
*/
public int compare(Object je1, Object je2)
{
- return (int)( ((JobEntry)je1).getNextRuntime() -
- ((JobEntry)je2).getNextRuntime() );
+ long obj1Time = ((JobEntry)je1).getNextRuntime();
+ long obj2Time = ((JobEntry)je2).getNextRuntime();
+
+ if (obj1Time > obj2Time)
+ return 1;
+ else if (obj1Time < obj2Time)
+ return -1;
+ else
+ return 0;
}
}