From d2de4b4cd48218301975802d8ed9a549aaf1765f Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 10 May 2013 17:28:48 -0700 Subject: Surround with try finally blocks --- .../dsub/service/DownloadServiceLifecycleSupport.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'subsonic-android/src/github') 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 { @Override protected Void doInBackground(Void... params) { - lock.lock(); - deserializeDownloadQueueNow(); - lock.unlock(); + try { + lock.lock(); + deserializeDownloadQueueNow(); + } finally { + lock.unlock(); + } return null; } } -- cgit v1.2.3