From d2ab6fbc6ac11d8d4684f2f855a5324548227917 Mon Sep 17 00:00:00 2001 From: Andrew Su <asu@redhat.com> Date: Mon, 18 Apr 2011 17:38:31 -0400 Subject: Changed cache to prevent jar overwriting when update happens. --- netx/net/sourceforge/jnlp/cache/CacheEntry.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'netx/net/sourceforge/jnlp/cache/CacheEntry.java') diff --git a/netx/net/sourceforge/jnlp/cache/CacheEntry.java b/netx/net/sourceforge/jnlp/cache/CacheEntry.java index affb5fb..8d70da6 100644 --- a/netx/net/sourceforge/jnlp/cache/CacheEntry.java +++ b/netx/net/sourceforge/jnlp/cache/CacheEntry.java @@ -162,4 +162,24 @@ public class CacheEntry { properties.store(); } + /** + * Mark this entry for deletion at shutdown. + */ + public void markForDelete() { // once marked it should not be unmarked. + properties.setProperty("delete", Boolean.toString(true)); + } + + /** + * Lock cache item. + */ + protected void lock() { + CacheUtil.lockFile(properties); + } + + /** + * Unlock cache item. + */ + protected void unlock() { + CacheUtil.unlockFile(properties); + } } -- cgit v1.2.3