Fix race between AMNotification() and Reserve() / Expand()

If the resource broker received a notification from the AM before
Reserve() (or Expand()) had started waiting on that notification, the
notification was lost and the resource was never claimed.

This patch ensures that it doesn't matter which side of the notification
gets there first. The new logic is mostly in WaitForNotification(). One
possible concern is that notifications for resources that are genuinely
not known by Impala will always live in the pending_requests_ map. This
would represent a bug in Llama, so it's ok to fix this in the future.

Change-Id: I31d90c1d55bfd9327d5fa063945411fc9820c040
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1891
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 1eeb4dc31e388c2b7e4e80384e1e1136032387df)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1930
Reviewed-by: Henry Robinson <henry@cloudera.com>