diff options
Diffstat (limited to 'netx/net/sourceforge')
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java index 2a91456..59ab00d 100644 --- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java @@ -78,6 +78,18 @@ enum CacheLRUWrapper { private PropertiesFile cacheOrder = new PropertiesFile( new File(cacheDir + File.separator + "recently_used")); + private CacheLRUWrapper(){ + File f = cacheOrder.getStoreFile(); + if (!f.exists()) { + try { + FileUtils.createParentDir(f); + FileUtils.createRestrictedFile(f, true); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + /** * Returns an instance of the policy. * @@ -181,12 +193,7 @@ enum CacheLRUWrapper { */ public synchronized void lock() { try { - File f = cacheOrder.getStoreFile(); - if (!f.exists()) { - FileUtils.createParentDir(f); - FileUtils.createRestrictedFile(f, true); - } - fl = FileUtils.getFileLock(f.getPath(), false, true); + fl = FileUtils.getFileLock(cacheOrder.getStoreFile().getPath(), false, true); } catch (OverlappingFileLockException e) { // if overlap we just increase the count. } catch (Exception e) { // We didn't get a lock.. e.printStackTrace(); |