title: Polling for a job status java
body: <p>I'm looking for a way to check a job status over a period of time:
  If during the polling I get a result that the job was completed, I return it, otherwise I keep polling until the period I set is over and return a failure result.
  I know how to do this using a timer and a while loop.
  Is there a better way of doing it?
  Thanks in advance</p>