Add uncaught exception handler to message retrieval thread
Related #6644 // FREEBIE
This commit is contained in:
parent
711740d156
commit
5672701a60
1 changed files with 11 additions and 1 deletions
|
@ -182,10 +182,14 @@ public class MessageRetrievalService extends Service implements InjectableType,
|
|||
return pipe;
|
||||
}
|
||||
|
||||
private class MessageRetrievalThread extends Thread {
|
||||
private class MessageRetrievalThread extends Thread implements Thread.UncaughtExceptionHandler {
|
||||
|
||||
private AtomicBoolean stopThread = new AtomicBoolean(false);
|
||||
|
||||
MessageRetrievalThread() {
|
||||
setUncaughtExceptionHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (!stopThread.get()) {
|
||||
|
@ -235,5 +239,11 @@ public class MessageRetrievalService extends Service implements InjectableType,
|
|||
public void stopThread() {
|
||||
stopThread.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
Log.w(TAG, "*** Uncaught exception!");
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue