@ Override public void stop ( final Throwable exception ) { LOG . entering ( CLASS_NAME , "stop" ) ; synchronized ( this . schedule ) { if ( this . isClosed ) { LOG . log ( Level . FINEST , "Clock has already been closed" ) ; return ; } this . isClosed = true ; this . exceptionCausedStop = exception ; final Time stopEvent = new StopTime ( this . timer . getCurrent ( ) ) ; LOG . log ( Level . FINE , "Stop scheduled immediately: {0} Outstanding client alarms: {1}" , new Object [ ] { stopEvent , this . numClientAlarms } ) ; assert this . numClientAlarms >= 0 ; this . numClientAlarms = 0 ; this . schedule . clear ( ) ; this . schedule . add ( stopEvent ) ; this . schedule . notify ( ) ; } LOG . exiting ( CLASS_NAME , "stop" ) ; }
Stop the clock on exception . Remove all other events from the schedule and fire StopTimer event immediately .