YARN-2017. Merged some of the common scheduler code. Contributed by Jian He. svn merge --ignore-ancestry -c 1596753 ../../trunk/