[SPARK-4813][Streaming] Fix the issue that ContextWaiter didn't handle 'spurious wakeup'

Used `Condition` to rewrite `ContextWaiter` because it provides a convenient API `awaitNanos` for timeout.
> what happens if awaitTermination times out, an error is thrown, and then we check isTerminated?

How about throwing the error in `isTerminated` for such case?