mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-10 02:26:18 +00:00
improving the error handling
This commit is contained in:
1 parent
abcb3fd8b5
commit
df32805382
1 file changed
+7
-4
@@ -26,6 +26,8 @@ package hudson;
|
||||
import hudson.Launcher.ProcStarter;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.remoting.Channel;
|
||||
import hudson.util.DaemonThreadFactory;
|
||||
import hudson.util.ExceptionCatchingThreadFactory;
|
||||
import hudson.util.IOException2;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.StreamCopyThread;
|
||||
@@ -130,7 +132,8 @@ public abstract class Proc {
|
||||
*/
|
||||
public abstract OutputStream getStdin();
|
||||
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool(new ExceptionCatchingThreadFactory(new DaemonThreadFactory()));
|
||||
|
||||
/**
|
||||
* Like {@link #join} but can be given a maximum time to wait.
|
||||
* @param timeout number of time units
|
||||
@@ -154,11 +157,11 @@ public abstract class Proc {
|
||||
kill();
|
||||
}
|
||||
} catch (InterruptedException x) {
|
||||
listener.error(x.toString());
|
||||
x.printStackTrace(listener.error("Failed to join a process"));
|
||||
} catch (IOException x) {
|
||||
listener.error(x.toString());
|
||||
x.printStackTrace(listener.error("Failed to join a process"));
|
||||
} catch (RuntimeException x) {
|
||||
listener.error(x.toString());
|
||||
x.printStackTrace(listener.error("Failed to join a process"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user