public static synchronized void persistInstallStatus ( List < UpdateCenterJob > installingPlugins ) { File installingPluginsFile = getInstallingPluginsFile ( ) ; if ( installingPlugins == null || installingPlugins . isEmpty ( ) ) { installingPluginsFile . delete ( ) ; return ; } LOGGER . fine ( "Writing install state to: " + installingPluginsFile . getAbsolutePath ( ) ) ; Map < String , String > statuses = new HashMap <> ( ) ; for ( UpdateCenterJob j : installingPlugins ) { if ( j instanceof InstallationJob && j . getCorrelationId ( ) != null ) { // only include install jobs with a correlation id (directly selected) InstallationJob ij = ( InstallationJob ) j ; InstallationStatus status = ij . status ; String statusText = status . getType ( ) ; if ( status instanceof Installing ) { // flag currently installing plugins as pending statusText = "Pending" ; } statuses . put ( ij . plugin . name , statusText ) ; } } try { String installingPluginXml = new XStream ( ) . toXML ( statuses ) ; FileUtils . write ( installingPluginsFile , installingPluginXml ) ; } catch ( IOException e ) { LOGGER . log ( SEVERE , "Failed to save " + installingPluginsFile . getAbsolutePath ( ) , e ) ; } }
Persists a list of installing plugins ; this is used in the case Jenkins fails mid - installation and needs to be restarted