public void stop(){
  long now=System.currentTimeMillis();
synchronized (timerThread) {
synchronized (this) {
      if (!stopped) {
        TimerThread.dequeue(this);
        remainingTime=Math.max(0,sleepUntil - now);
        sleepUntil=now;
        stopped=true;
      }
    }
  }
}

public void stop ( ) { long now = System . currentTimeMillis ( ) ; synchronized ( timerThread ) { synchronized ( this ) { if ( ! stopped ) { TimerThread . dequeue ( this ) ; remainingTime = Math . max ( 0 , sleepUntil - now ) ; sleepUntil = now ; stopped = true ; } } } }
stops the timer . the amount of time the timer has already delayed is saved so if the timer is continued , it will only delay for the amount of time remaining . note that even after stopping a timer , one more tick may still occur . this method is mt - safe ; i . e . it is synchronized but for implementation reasons , the synchronized modifier cannot be included in the method declaration .
