1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-10 14:16:00 +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;
} }
}); });