@ Override public void close ( ) { LOG . entering ( CLASS_NAME , "close" ) ; synchronized ( this . schedule ) { if ( this . isClosed ) { LOG . exiting ( CLASS_NAME , "close" , "Clock has already been closed" ) ; return ; } this . isClosed = true ; final Time stopEvent = new StopTime ( Math . max ( this . timer . getCurrent ( ) , this . lastClientAlarm + 1 ) ) ; LOG . log ( Level . FINE , "Graceful shutdown scheduled: {0} Outstanding client alarms: {1}" , new Object [ ] { stopEvent , this . numClientAlarms } ) ; this . schedule . add ( stopEvent ) ; this . schedule . notify ( ) ; } LOG . exiting ( CLASS_NAME , "close" ) ; }
Wait for all client alarms to finish executing and gracefully shutdown the clock .