diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index d6f393df85..b5980a9d2e 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -27,6 +27,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; +import java.io.StringWriter; +import java.io.PrintWriter; import java.lang.management.LockInfo; import java.lang.management.ManagementFactory; import java.lang.management.MonitorInfo; @@ -622,4 +624,10 @@ public class Functions { if(b==null) return true; return b; } + + public static String printThrowable(Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + return sw.toString(); + } } diff --git a/core/src/main/java/hudson/model/Executor.java b/core/src/main/java/hudson/model/Executor.java index 4beb40b05e..97960ccca1 100644 --- a/core/src/main/java/hudson/model/Executor.java +++ b/core/src/main/java/hudson/model/Executor.java @@ -13,7 +13,7 @@ import java.io.IOException; * * @author Kohsuke Kawaguchi */ -public class Executor extends Thread { +public class Executor extends Thread implements ModelObject { private final Computer owner; private final Queue queue; @@ -25,6 +25,8 @@ public class Executor extends Thread { private int number; private Queue.Executable executable; + private Throwable causeOfDeath; + public Executor(Computer owner) { super("Executor #"+owner.getExecutors().size()+" for "+owner.getDisplayName()); this.owner = owner; @@ -34,36 +36,44 @@ public class Executor extends Thread { } public void run() { - while(true) { - if(Hudson.getInstance().isTerminating()) - return; - - synchronized(owner) { - if(owner.getNumExecutors() + + + + + + + + + + +

+ + Thread is still alive +

+
+ +

+ + Thread has died +

+
${h.printThrowable(it.causeOfDeath)}
+
+            more info
+          
+
+
+
+
+ diff --git a/core/src/main/resources/lib/hudson/executors.jelly b/core/src/main/resources/lib/hudson/executors.jelly index 637cb7749c..90f5209977 100644 --- a/core/src/main/resources/lib/hudson/executors.jelly +++ b/core/src/main/resources/lib/hudson/executors.jelly @@ -40,7 +40,7 @@ - + Dead (!)