Source:
<code>private void trackInitialPluginInstall(@Nonnull final List<Future<UpdateCenter.UpdateCenterJob>> installJobs) { final Jenkins jenkins = Jenkins.getActiveInstance(); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); updateCenter.persistInstallStatus(); if (!Jenkins.getInstance().getInstallState().isSetupComplete()) { if (jenkins.getInstallState() == InstallState.NEW) { <START> jenkins.setInstallState(InstallState.INITIAL_PLUGINS_INSTALLING); <END> } new Thread() { @Override public void run() { boolean failures = false; INSTALLING: while (true) { try { updateCenter.persistInstallStatus(); Thread.sleep(500); failures = false; for (Future<UpdateCenter.UpdateCenterJob> jobFuture : installJobs) { if(!jobFuture.isDone() && !jobFuture.isCancelled()) { continue INSTALLING; } UpdateCenter.UpdateCenterJob job = jobFuture.get(); if(job instanceof InstallationJob && ((InstallationJob)job).status instanceof DownloadJob.Failure) { failures = true; } } } catch (Exception e) { LOGGER.log(WARNING, "Unexpected error while waiting for initial plugin set to install.", e); } break; } updateCenter.persistInstallStatus(); if(!failures) { InstallState.INITIAL_PLUGINS_INSTALLING.proceedToNextState(); } } }.start(); } new Thread() { @Override public void run() { INSTALLING: while (true) { for (Future<UpdateCenter.UpdateCenterJob> deployJob : installJobs) { try { Thread.sleep(500); } catch (InterruptedException e) { LOGGER.log(SEVERE, "Unexpected error while waiting for some plugins to install. Plugin Manager state may be invalid. Please restart Jenkins ASAP.", e); } if (!deployJob.isCancelled() && !deployJob.isDone()) { continue INSTALLING; } } resolveDependantPlugins(); break; } } }.start(); }</code><technical_language>this is a part of InstallState proceed-chain? transition NEW INITIAL_PLUGINS_INSTALLING is done in some custom way. Also, if current state is NEW</technical_language>

Target:
private void trackInitialPluginInstall(@Nonnull final List<Future<UpdateCenter.UpdateCenterJob>> installJobs) { final Jenkins jenkins = Jenkins.getInstance(); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); if (!Jenkins.getInstance().getInstallState().isSetupComplete()) { jenkins.setInstallState(InstallState.INITIAL_PLUGINS_INSTALLING); updateCenter.persistInstallStatus(); new Thread() { @Override public void run() { boolean failures = false; INSTALLING: while (true) { try { updateCenter.persistInstallStatus(); Thread.sleep(500); failures = false; for (Future<UpdateCenter.UpdateCenterJob> jobFuture : installJobs) { if(!jobFuture.isDone() && !jobFuture.isCancelled()) { continue INSTALLING; } UpdateCenter.UpdateCenterJob job = jobFuture.get(); if(job instanceof InstallationJob && ((InstallationJob)job).status instanceof DownloadJob.Failure) { failures = true; } } } catch (Exception e) { LOGGER.log(WARNING, "Unexpected error while waiting for initial plugin set to install.", e); } break; } updateCenter.persistInstallStatus(); if(!failures) { InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_PLUGINS_INSTALLING); } } }.start(); } new Thread() { @Override public void run() { INSTALLING: while (true) { for (Future<UpdateCenter.UpdateCenterJob> deployJob : installJobs) { try { Thread.sleep(500); } catch (InterruptedException e) { LOGGER.log(SEVERE, "Unexpected error while waiting for some plugins to install. Plugin Manager state may be invalid. Please restart Jenkins ASAP.", e); } if (!deployJob.isCancelled() && !deployJob.isDone()) { continue INSTALLING; } } resolveDependantPlugins(); break; } } }.start(); }