aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-14 19:56:18 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-14 19:56:18 -0700
commit07cdb62bb7cddcf9cbe499cf3d05e29b4be34644 (patch)
tree403e2edea594f4f3706d9aa242c2eacb9c28e590 /src/github/daneren2005
parenta584c0d6fedb39b6a7c0fdedb5ff62928c9e6f90 (diff)
downloaddsub-07cdb62bb7cddcf9cbe499cf3d05e29b4be34644.tar.gz
dsub-07cdb62bb7cddcf9cbe499cf3d05e29b4be34644.tar.bz2
dsub-07cdb62bb7cddcf9cbe499cf3d05e29b4be34644.zip
Change so final serialization on exit is done in background thread still
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 278c7e4f..afcea3e5 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -238,8 +238,8 @@ public class DownloadServiceLifecycleSupport {
}
public void onDestroy() {
+ serializeDownloadQueue();
eventLooper.quit();
- serializeDownloadQueueNow();
downloadService.unregisterReceiver(ejectEventReceiver);
downloadService.unregisterReceiver(intentReceiver);
@@ -256,12 +256,13 @@ public class DownloadServiceLifecycleSupport {
return;
}
+ final List<DownloadFile> songs = new ArrayList<DownloadFile>(downloadService.getSongs());
eventHandler.post(new Runnable() {
@Override
public void run() {
if(lock.tryLock()) {
try {
- serializeDownloadQueueNow();
+ serializeDownloadQueueNow(songs);
} finally {
lock.unlock();
}
@@ -270,8 +271,7 @@ public class DownloadServiceLifecycleSupport {
});
}
- public void serializeDownloadQueueNow() {
- List<DownloadFile> songs = new ArrayList<DownloadFile>(downloadService.getSongs());
+ public void serializeDownloadQueueNow(List<DownloadFile> songs) {
State state = new State();
for (DownloadFile downloadFile : songs) {
state.songs.add(downloadFile.getSong());