title: Conditional scheduling of task
body: <p>I need to schedule a task using java timer, which does the following:</p>
  
  <ul>
  <li><p>Send a request every 5 minutes (which receives a status as a response)</p></li>
  <li><p>if (status != end state), then query status every 10 seconds for the next 2 minutes until    it reaches end state. If it doesn't reach end state by the end of 2 minutes, sleep for 3 minutes and resend the request.</p></li>
  <li><p>After 3 failed attempts (checking status for 2 mins with 10s interval), if end state not reached, revert back to 5 minute check interval</p></li>
  </ul>
  
  <p>Logic for sending request and querying status has been taken care of. I couldn't figure out scheduling the tasks at various intervals. </p>
  
  <p>I know the run() method should remember the last state of the task so that it can re-schedule the task appropriately. </p>
  
  <p>I'm fairly new to timers. Any help would be really appreciated.</p>