Reuse more code in YarnClientSchedulerBackend

We implement a while loop to monitor an application's state in
four separate places (stable/Client, alpha/Client, and twice in
YarnClientSchedulerBackend). This commit reduces this to one.
Guard against potential NPE in debug logging mode

The getClientToken (or getClientToAMToken) method in Hadoop
apparently returns null sometimes. We need to prevent NPEs that
result from this. Yay documentation.