- Class Jobqueuejobinprogresslistener extends Jobinprogresslistener, Where Jobqueuejobinprogresslistener has a static inner class Jobschedulinginfo
- int compare (object O1, Object O2) returns the integral type of a primitive type
If you want to sort in ascending order,
Then O1 is less than O2, returns 1 (negative number), equals returns 0,01 greater than 02 returns 1 (positive number)
If you want to sort in descending order
Then O1 is less than O2, returns 1 (positive), equals returns 0,01 greater than 02 returns-1 (negative number)
- Sort by jobschedulinginfo information in ascending order
- Static final comparator<jobschedulinginfo> Fifo_job_queue_comparator
= new Comparator<jobschedulinginfo> () {
public int Compare (Jobschedulinginfo O1, Jobschedulinginfo O2) {
int res = o1.getpriority (). CompareTo (O2.getpriority ());
if (res = = 0) {
if (O1.getstarttime () < O2.getstarttime ()) {
res =-1;
} else {
res = (O1.getstarttime () = = O2.getstarttime ()? 0:1);
}
}
if (res = = 0) {
res = O1.getjobid (). CompareTo (O2.getjobid ());
}
return res;
}
};
The specific implementation of the comparator in the FIFO scheduler