1 7 package org.jboss.jms.server.list; 8 9 import java.util.Comparator ; 10 11 import org.jboss.jms.server.MessageReference; 12 13 19 public class StandardMessageComparator 20 implements Comparator 21 { 22 24 26 28 30 32 34 public int compare(Object o1, Object o2) 35 { 36 try 37 { 38 MessageReference r1 = (MessageReference) o1; 39 MessageReference r2 = (MessageReference) o2; 40 int p1 = r1.getPriority(); 41 int p2 = r2.getPriority(); 42 if (p1 != p2) return p2-p1; 43 String l1 = r1.getMessageID(); 44 String l2 = r2.getMessageID(); 45 return l1.compareTo(l2); 46 } 47 catch (Exception e) 48 { 49 throw new RuntimeException ("Error during comparison", e); 50 } 51 } 52 53 55 57 59 61 } 62 | Popular Tags |