/hg/icedtea-web: Fix PR726. Create recently_used on startup.
asu at icedtea.classpath.org
asu at icedtea.classpath.org
Wed May 25 11:48:32 PDT 2011
changeset d878cc072253 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=d878cc072253
author: Andrew Su <asu at redhat.com>
date: Wed May 25 14:50:42 2011 -0400
Fix PR726. Create recently_used on startup.
diffstat:
ChangeLog | 6 ++++++
netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java | 19 +++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r f1615c79971d -r d878cc072253 ChangeLog
--- a/ChangeLog Tue May 17 16:43:45 2011 +0200
+++ b/ChangeLog Wed May 25 14:50:42 2011 -0400
@@ -1,3 +1,9 @@
+2011-05-20 Andrew Su <asu at redhat.com>
+
+ * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java:
+ (CacheLRUWrapper): New constructor to create file.
+ (lock): Removed creation of file here.
+
2011-05-17 Jiri Vanek <jvanek at redhat.com>
* tests/junit-runner/JunitLikeXmlOutputListener: This listener exports
diff -r f1615c79971d -r d878cc072253 netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Tue May 17 16:43:45 2011 +0200
+++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Wed May 25 14:50:42 2011 -0400
@@ -78,6 +78,18 @@
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 @@
*/
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();
More information about the distro-pkg-dev
mailing list