All pastes #9805 Raw Edit

Timer question

public java v1 · immutable
#9805 ·published 2005-04-19 02:43 UTC
rendered paste body
   private void start_ack_timer( ) {     if (ackTimer == null)       ackTimer = new Timer();     ackTimer.schedule(new ackTime(), 1000);   }   private void stop_ack_timer() {     if (ackTimer != null)       ackTimer.cancel();     ackTimer = null;   }   class ackTime extends TimerTask {     public void run() {       System.out.println("Ack Timed out!");       swe.generate_acktimeout_event();       this.cancel(); //Terminate the timer thread     }   }