negating compare is bad

This commit is contained in:
Xavier Léauté 2014-09-15 12:17:32 -07:00
parent 137ad50bf1
commit c8b8e3f6e9
3 changed files with 3 additions and 3 deletions

View File

@ -799,7 +799,7 @@ public class RemoteTaskRunner implements TaskRunner, TaskLogStreamer
ZkWorker zkWorker, ZkWorker zkWorker2
)
{
int retVal = -Ints.compare(zkWorker.getCurrCapacityUsed(), zkWorker2.getCurrCapacityUsed());
int retVal = Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed());
if (retVal == 0) {
retVal = zkWorker.getWorker().getHost().compareTo(zkWorker2.getWorker().getHost());
}

View File

@ -249,7 +249,7 @@ public class PrioritizedExecutorService extends AbstractExecutorService implemen
@Override
public int compareTo(PrioritizedListenableFutureTask otherTask)
{
return -Ints.compare(getPriority(), otherTask.getPriority());
return Ints.compare(otherTask.getPriority(), getPriority());
}
}
}

View File

@ -34,7 +34,7 @@ public class HighestPriorityTierSelectorStrategy extends AbstractTierSelectorStr
@Override
public int compare(Integer o1, Integer o2)
{
return -Ints.compare(o1, o2);
return Ints.compare(o2, o1);
}
};