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:
parent
7980e2cedb
commit
edcde28ecd
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue