@ edu . umd . cs . findbugs . annotations . SuppressFBWarnings ( "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" ) public void cleanUp ( ) { if ( theInstance != this && theInstance != null ) { LOGGER . log ( Level . WARNING , "This instance is no longer the singleton, ignoring cleanUp()" ) ; return ; } synchronized ( Jenkins . class ) { if ( cleanUpStarted ) { LOGGER . log ( Level . WARNING , "Jenkins.cleanUp() already started, ignoring repeated cleanUp()" ) ; return ; } cleanUpStarted = true ; } try { LOGGER . log ( Level . INFO , "Stopping Jenkins" ) ; final List < Throwable > errors = new ArrayList <> ( ) ; fireBeforeShutdown ( errors ) ; _cleanUpRunTerminators ( errors ) ; terminating = true ; final Set < Future < ? > > pending = _cleanUpDisconnectComputers ( errors ) ; _cleanUpShutdownUDPBroadcast ( errors ) ; _cleanUpCloseDNSMulticast ( errors ) ; _cleanUpInterruptReloadThread ( errors ) ; _cleanUpShutdownTriggers ( errors ) ; _cleanUpShutdownTimer ( errors ) ; _cleanUpShutdownTcpSlaveAgent ( errors ) ; _cleanUpShutdownPluginManager ( errors ) ; _cleanUpPersistQueue ( errors ) ; _cleanUpShutdownThreadPoolForLoad ( errors ) ; _cleanUpAwaitDisconnects ( errors , pending ) ; _cleanUpPluginServletFilters ( errors ) ; _cleanUpReleaseAllLoggers ( errors ) ; LOGGER . log ( Level . INFO , "Jenkins stopped" ) ; if ( ! errors . isEmpty ( ) ) { StringBuilder message = new StringBuilder ( "Unexpected issues encountered during cleanUp: " ) ; Iterator < Throwable > iterator = errors . iterator ( ) ; message . append ( iterator . next ( ) . getMessage ( ) ) ; while ( iterator . hasNext ( ) ) { message . append ( "; " ) ; message . append ( iterator . next ( ) . getMessage ( ) ) ; } iterator = errors . iterator ( ) ; RuntimeException exception = new RuntimeException ( message . toString ( ) , iterator . next ( ) ) ; while ( iterator . hasNext ( ) ) { exception . addSuppressed ( iterator . next ( ) ) ; } throw exception ; } } finally { theInstance = null ; if ( JenkinsJVM . isJenkinsJVM ( ) ) { JenkinsJVMAccess . _setJenkinsJVM ( oldJenkinsJVM ) ; } ClassFilterImpl . unregister ( ) ; } }
Called to shut down the system .