YARN-2946. Fixed potential deadlock in RMStateStore. Contributed by Rohith Sharmaks
(cherry picked from commit 4f18018b7abb405f38d269da096ec9fd80c81d9a)