public void start ( ) { if ( timer != null ) throw new IllegalStateException ( "already running" ) ; if ( interval < BUSY_WAITING_THRESHOLD ) timer = new MyBusyTimer ( ) ; else if ( interval < MILLISECOND_THRESHOLD ) timer = new MyWaitingTimer ( ) ; else timer = new MyMillisecondTimer ( ) ; Thread thread = new Thread ( timer , "timer" ) ; thread . setDaemon ( true ) ; thread . start ( ) ; }
Starts generating tick events starting from 0 . This method must not be called when the tick source is already running .