Skip to content

Commit

Permalink
Merge pull request #252 from rysteboe/uncaught-exception-handler
Browse files Browse the repository at this point in the history
[JENKINS-49415] Add additional UncaughtExceptionHandler
  • Loading branch information
rysteboe committed Feb 6, 2018
2 parents e53ebbc + 5e32871 commit 1d5b0e5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/java/hudson/remoting/Engine.java
Expand Up @@ -88,14 +88,13 @@ public class Engine extends Thread {
private final ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactory() {
private final ThreadFactory defaultFactory = Executors.defaultThreadFactory();
public Thread newThread(final Runnable r) {
Thread t = defaultFactory.newThread(new Runnable() {
public void run() {
CURRENT.set(Engine.this);
r.run();
}
Thread thread = defaultFactory.newThread(() -> {
CURRENT.set(Engine.this);
r.run();
});
t.setDaemon(true);
return t;
thread.setDaemon(true);
thread.setUncaughtExceptionHandler((t, e) -> LOGGER.log(Level.SEVERE, "Uncaught exception in thread " + t, e));
return thread;
}
});

Expand Down

0 comments on commit 1d5b0e5

Please sign in to comment.