Source:
<code>private void trackInitialPluginInstall(@Nonnull final List<Future<UpdateCenter.UpdateCenterJob>> installJobs) { final Jenkins jenkins = Jenkins.get(); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); final Authentication currentAuth = Jenkins.getAuthentication(); <START> if (!Jenkins.get().getInstallState().isSetupComplete()) { <END> 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) { try (ACLContext acl = ACL.as(currentAuth)) { 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; } } resolveDependentPlugins(); break; } } }.start(); }</code><technical_language>suggestion if (!jenkins.getInstallState().isSetupComplete()) {</technical_language>

Target:
private void trackInitialPluginInstall(@Nonnull final List<Future<UpdateCenter.UpdateCenterJob>> installJobs) { final Jenkins jenkins = Jenkins.get(); final UpdateCenter updateCenter = jenkins.getUpdateCenter(); final Authentication currentAuth = Jenkins.getAuthentication(); if (!jenkins.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) { try (ACLContext acl = ACL.as(currentAuth)) { 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; } } resolveDependentPlugins(); break; } } }.start(); }