changeset 1019:a54294dbc82d

Fixed CacheUtil clearCache to also remove LRU entries. 2014-09-02 Jie Kang <jkang@redhat.com> Fixed CacheUtils clearCache method to also clear the Least Recently Used entries. * netx/net/sourceforge/jnlp/cache/CacheUtil.java
author Jie Kang <jkang@redhat.com>
date Tue, 02 Sep 2014 11:46:09 -0400
parents 072cd514ce9f
children a0d25551282d
files ChangeLog netx/net/sourceforge/jnlp/cache/CacheUtil.java
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Oct 31 14:13:54 2014 +0100
+++ b/ChangeLog	Tue Sep 02 11:46:09 2014 -0400
@@ -1,3 +1,9 @@
+2014-09-02  Jie Kang  <jkang@redhat.com>
+
+	Fixed CacheUtils clearCache method to also clear the Least Recently Used
+	entries.
+	* netx/net/sourceforge/jnlp/cache/CacheUtil.java:
+
 2014-10-31  Jiri Vanek  <jvanek@redhat.com>
 
 	* tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java	Fri Oct 31 14:13:54 2014 +0100
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java	Tue Sep 02 11:46:09 2014 -0400
@@ -188,12 +188,17 @@
         }
 
         OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Clearing cache directory: " + cacheDir);
+        lruHandler.lock();
         try {
             cacheDir = cacheDir.getCanonicalFile();
             FileUtils.recursiveDelete(cacheDir, cacheDir);
             cacheDir.mkdir();
+            lruHandler.clearLRUSortedEntries();
+            lruHandler.store();
         } catch (IOException e) {
             throw new RuntimeException(e);
+        } finally {
+            lruHandler.unlock();
         }
         return true;
     }