diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-10 17:28:48 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-10 17:28:48 -0700 |
commit | d2de4b4cd48218301975802d8ed9a549aaf1765f (patch) | |
tree | 013d88230c91e4c499ad3eb5e635dd61d416de32 /subsonic-android/src/github/daneren2005 | |
parent | e93e67ba88c901cfd3050256e474af07000b0918 (diff) | |
download | dsub-d2de4b4cd48218301975802d8ed9a549aaf1765f.tar.gz dsub-d2de4b4cd48218301975802d8ed9a549aaf1765f.tar.bz2 dsub-d2de4b4cd48218301975802d8ed9a549aaf1765f.zip |
Surround with try finally blocks
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index a31ac657..98e86706 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -313,8 +313,11 @@ public class DownloadServiceLifecycleSupport { @Override protected Void doInBackground(Void... params) { if(lock.tryLock()) { - serializeDownloadQueueNow(); - lock.unlock(); + try { + serializeDownloadQueueNow(); + } finally { + lock.unlock(); + } } return null; } @@ -322,9 +325,12 @@ public class DownloadServiceLifecycleSupport { private class DeserializeTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { - lock.lock(); - deserializeDownloadQueueNow(); - lock.unlock(); + try { + lock.lock(); + deserializeDownloadQueueNow(); + } finally { + lock.unlock(); + } return null; } } |