public static final TimeoutToken addTimeoutHandler(long runTime,Runnable handler){
  TimeoutToken token=new TimeoutToken(runTime,handler);
synchronized (todolist) {
    todolist.add(token);
    Collections.sort(todolist);
    if (timeoutThread != null)     timeoutThread.interrupt();
 else {
      timeoutThread=new TimeoutThread();
      timeoutThread.setDaemon(true);
      timeoutThread.start();
    }
  }
  return token;
}

public static final TimeoutToken addTimeoutHandler ( long runTime , Runnable handler ) { TimeoutToken token = new TimeoutToken ( runTime , handler ) ; synchronized ( todolist ) { todolist . add ( token ) ; Collections . sort ( todolist ) ; if ( timeoutThread != null ) timeoutThread . interrupt ( ) ; else { timeoutThread = new TimeoutThread ( ) ; timeoutThread . setDaemon ( true ) ; timeoutThread . start ( ) ; } } return token ; }
it is assumed that the passed handler will not execute for a long time .
