Wait for downloadCompletionThread to finish before stopping executors used by the thread

This commit is contained in:
ByteHamster 2019-12-02 13:07:51 +01:00
parent cb3b1f2b1f
commit c752d90f4f
1 changed files with 5 additions and 0 deletions

View File

@ -218,6 +218,11 @@ public class DownloadService extends Service {
nm.cancel(NOTIFICATION_ID); nm.cancel(NOTIFICATION_ID);
downloadCompletionThread.interrupt(); downloadCompletionThread.interrupt();
try {
downloadCompletionThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
syncExecutor.shutdown(); syncExecutor.shutdown();
schedExecutor.shutdown(); schedExecutor.shutdown();
cancelNotificationUpdater(); cancelNotificationUpdater();