title: Scheduled Event after some time Or Based on User Request
body: <p>I want to have an operation(Task) to be Scheduled after some time OR Based on User Request. 
  In my code I have something like this</p>
  
  <pre><code>Timer timer = new Timer();
  TimerTask timerTask = new TimerTask();
  timer.schedule(timerTask,time);//Time in milli seconds
  
  if(UserRequestedtoCancel)
  {
    // Do operatation 
    timerTask.cancel(); 
  } 
  </code></pre>
  
  <p>The problem is My task is still being executed after that time I specified, but only once. 
  Should I also do timer.cancel(), or something else to avoid the task been executed?</p>
  
  <p>Thanks</p>