Merge r1516331 from trunk to branch-2 for YARN-881. Priority#compareTo method seems to be wrong. (Jian He via bikas)