@ Override public void run ( ) { if ( state . compareAndSet ( State . STARTED , State . STOPPING ) ) { for ( final Runnable hook : hooks ) { try { hook . run ( ) ; } catch ( final Throwable t ) { LOGGER . error ( SHUTDOWN_HOOK_MARKER , "Caught exception executing shutdown hook {}" , hook , t ) ; } } state . set ( State . STOPPED ) ; } }
Executes the registered shutdown callbacks .