title: Java Timer with timeout capability
body: <p>I am implementing a timer: </p>
  
  <pre><code>timer = new Timer();
              timer.schedule(new TimerTask() {
                  @Override
                  public void run() {
                      //Do something;
                  }
              },1000,1000);
  </code></pre>
  
  <p>But, I would like to have a timeout so that after lets say 100 tries/ 10 seconds, the timer stops automatically.</p>
  
  <p>Thanks.</p>