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 } }