Skip to content

Commit

Permalink
[JENKINS-37772] - Get rid of Initializer(after = InitMilestone.COMPLE…
Browse files Browse the repository at this point in the history
…TED) (#73)
  • Loading branch information
oleg-nenashev authored and aheritier committed Aug 29, 2016
1 parent 90a425b commit 571a06f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/com/cloudbees/jenkins/support/SupportPlugin.java
Expand Up @@ -68,6 +68,8 @@
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import org.jenkinsci.remoting.RoleChecker;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;

import java.io.BufferedOutputStream;
Expand Down Expand Up @@ -404,11 +406,11 @@ public static void loadConfig() throws IOException {

private static final boolean logStartupPerformanceIssues = Boolean.getBoolean(SupportPlugin.class.getCanonicalName() + ".threadDumpStartup");
private static final int secondsPerThreadDump = Integer.getInteger(SupportPlugin.class.getCanonicalName() + ".secondsPerTD", 60);
private static boolean milestonesCompleted = false;

@Initializer(after = InitMilestone.COMPLETED)
@Deprecated
@Restricted(NoExternalUse.class)
public static void completedMilestones() throws IOException {
milestonesCompleted = true;
// Do nothing
}

@Initializer(after = InitMilestone.STARTED)
Expand All @@ -427,7 +429,11 @@ public static void threadDumpStartup() throws Exception {
Thread t = new Thread("Support core plugin startup diagnostics") {
@Override
public void run() {
while (!milestonesCompleted) {
while (true) {
final Jenkins jenkins =Jenkins.getInstance();
if (jenkins == null || jenkins.getInitLevel() != InitMilestone.COMPLETED) {
continue;
}
PrintStream ps = null;
FileOutputStream fileOutputStream = null;
try {
Expand Down

0 comments on commit 571a06f

Please sign in to comment.