提交 df328053 编写于 作者: K Kohsuke Kawaguchi

improving the error handling

上级 abcb3fd8
...@@ -26,6 +26,8 @@ package hudson; ...@@ -26,6 +26,8 @@ package hudson;
import hudson.Launcher.ProcStarter; import hudson.Launcher.ProcStarter;
import hudson.model.TaskListener; import hudson.model.TaskListener;
import hudson.remoting.Channel; import hudson.remoting.Channel;
import hudson.util.DaemonThreadFactory;
import hudson.util.ExceptionCatchingThreadFactory;
import hudson.util.IOException2; import hudson.util.IOException2;
import hudson.util.NullStream; import hudson.util.NullStream;
import hudson.util.StreamCopyThread; import hudson.util.StreamCopyThread;
...@@ -130,7 +132,8 @@ public abstract class Proc { ...@@ -130,7 +132,8 @@ public abstract class Proc {
*/ */
public abstract OutputStream getStdin(); 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. * Like {@link #join} but can be given a maximum time to wait.
* @param timeout number of time units * @param timeout number of time units
...@@ -154,11 +157,11 @@ public abstract class Proc { ...@@ -154,11 +157,11 @@ public abstract class Proc {
kill(); kill();
} }
} catch (InterruptedException x) { } catch (InterruptedException x) {
listener.error(x.toString()); x.printStackTrace(listener.error("Failed to join a process"));
} catch (IOException x) { } catch (IOException x) {
listener.error(x.toString()); x.printStackTrace(listener.error("Failed to join a process"));
} catch (RuntimeException x) { } catch (RuntimeException x) {
listener.error(x.toString()); x.printStackTrace(listener.error("Failed to join a process"));
} }
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册