YARN-2209. Replaced AM resync/shutdown command with corresponding exceptions and made related MR changes. Contributed by Jian He.

(cherry picked from commit 0f3b6900be1a3b2e4624f31f84656f4a32dadce9)