1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Set UncaughtExceptionHandler for CACHED_EXECUTOR_SERVICE

In order to avoid uncaught exceptions from terminating the
program (SMACK-896).
This commit is contained in:
Florian Schmaus 2019-05-09 11:04:26 +02:00
parent 7980e2cedb
commit edcde28ecd

View file

@ -294,6 +294,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
Thread thread = new Thread(runnable); Thread thread = new Thread(runnable);
thread.setName("Smack Cached Executor"); thread.setName("Smack Cached Executor");
thread.setDaemon(true); thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
LOGGER.log(Level.WARNING, t + " encountered uncaught exception", e);
}
});
return thread; return thread;
} }
}); });