YARN-2526. SLS can deadlock when all the threads are taken by AMSimulators. (Wei Yan via kasha)

(cherry picked from commit 28d99db99236ff2a6e4a605802820e2b512225f9)