YARN-2387. Resource Manager crashes with NPE due to lack of synchronization. Contributed by Mit Desai
(cherry picked from commit feaf139b4f327d33011e5a4424c06fb44c630955)