jvanzyl 01/06/21 06:54:18
Modified: src/java/org/apache/turbine/services/schedule JobEntry.java
JobQueue.java
Log:
- apply patches by kasper that remove the deps on the QuickSort and
Comparable classes in the util package.
Revision Changes Path
1.14 +24 -1
jakarta-turbine/src/java/org/apache/turbine/services/schedule/JobEntry.java
Index: JobEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/schedule/JobEntry.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- JobEntry.java 2001/05/20 00:04:04 1.13
+++ JobEntry.java 2001/06/21 13:54:16 1.14
@@ -66,9 +66,10 @@
* Unix scheduler cron.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
- * @version $Id: JobEntry.java,v 1.13 2001/05/20 00:04:04 jon Exp $
+ * @version $Id: JobEntry.java,v 1.14 2001/06/21 13:54:16 jvanzyl Exp $
*/
public class JobEntry extends BaseObject
+ implements Comparable
{
/** Valid entry ( 0-60 ). **/
private int second = -1;
@@ -542,6 +543,28 @@
return DAY_OF_MONTH;
}
+ }
+
+ /**
+ * Used for ordering Jobentries
+ *
+ * Note: this comparator imposes orderings that are inconsistent with
+ * equals.
+ *
+ * @param je1 The first <code>JobEntry</code> object.
+ * @return An <code>int</code> indicating the result of the comparison.
+ */
+ public int compareTo(Object je)
+ {
+ long obj1Time = this.getNextRuntime();
+ long obj2Time = ((JobEntry)je).getNextRuntime();
+
+ if (obj1Time > obj2Time)
+ return 1;
+ else if (obj1Time < obj2Time)
+ return -1;
+ else
+ return 0;
}
/**
1.7 +3 -35
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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JobQueue.java 2001/05/05 14:43:59 1.6
+++ JobQueue.java 2001/06/21 13:54:16 1.7
@@ -56,17 +56,15 @@
import java.util.List;
import java.util.Vector;
-import org.apache.turbine.util.Comparable;
-import org.apache.turbine.util.QuickSort;
+import java.util.Collections;
/**
* Queue for the scheduler.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
- * @version $Id: JobQueue.java,v 1.6 2001/05/05 14:43:59 jvanzyl Exp $
+ * @version $Id: JobQueue.java,v 1.7 2001/06/21 13:54:16 jvanzyl Exp $
*/
public class JobQueue
- implements Comparable
{
/**
* The queue of <code>JobEntry</code> objects.
@@ -211,36 +209,6 @@
*/
private void sortQueue()
{
- // First sort.
- Object data[] = new Object[queue.size()];
- queue.copyInto(data);
- QuickSort.quickSort(data, 0, data.length - 1, this);
- queue.removeAllElements();
-
- for (int i = 0; i < data.length; i++)
- {
- queue.add(data[i]);
- }
- }
-
- /**
- * Compare to another <code>JobEntry</code>. Used by the
- * <code>QuickSort</code> class to determine sort order.
- *
- * @param je1 The first <code>JobEntry</code> object.
- * @param je2 The second <code>JobEntry</code> object.
- * @return An <code>int</code> indicating the result of the comparison.
- */
- public int compare(Object je1, Object je2)
- {
- long obj1Time = ((JobEntry)je1).getNextRuntime();
- long obj2Time = ((JobEntry)je2).getNextRuntime();
-
- if (obj1Time > obj2Time)
- return 1;
- else if (obj1Time < obj2Time)
- return -1;
- else
- return 0;
+ Collections.sort(queue);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]