From 54374fc2b6b4874ce4de4dfdb6c082c7577d48a6 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 9 Dec 2015 13:54:08 -0500 Subject: [PATCH] If the initialization thread is interrupted by contextDestroyed, make that clear. Otherwise get a meaningless error: java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:502) at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:267) at jenkins.InitReactorRunner.run(InitReactorRunner.java:44) at jenkins.model.Jenkins.executeReactor(Jenkins.java:915) at jenkins.model.Jenkins.(Jenkins.java:814) at hudson.model.Hudson.(Hudson.java:83) at hudson.model.Hudson.(Hudson.java:79) at hudson.WebAppMain$3.run(WebAppMain.java:225) --- core/src/main/java/hudson/WebAppMain.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index 11d438d5ab..d3375be646 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -396,8 +396,10 @@ public class WebAppMain implements ServletContextListener { if(instance!=null) instance.cleanUp(); Thread t = initThread; - if (t!=null) + if (t != null && t.isAlive()) { + LOGGER.log(Level.INFO, "Shutting down a Jenkins instance that was still starting up", new Throwable("reason")); t.interrupt(); + } // Logger is in the system classloader, so if we don't do this // the whole web app will never be undepoyed.