[RFC][Icedtea-web]: Changed how cache works.
Andrew Su
asu at redhat.com
Mon Apr 4 09:12:31 PDT 2011
Hi,
I have attached a patch for changing how cache stores its entries to fix some problems that existed in the current cache system.
Right now the jar files may be overwritten by another plugin/javaws when a new version is pushed while the user is using an old version (prior update) then open another instance of the applet/javaws. With the patch this gets fixed by creating a new location for the update to be downloaded to instead of overwriting the current file.
[I'm going to use applet, but assume I mean applet+javaws]
Another issue with the current one is.. When loading the same applet twice (or more), it could detect that it's not current and both applet would download to the same place. In the patch, we will wait for the download to finish first then check if we have already downloaded it. If so just proceed without re-downloading.
This patch makes the cache keep track of the most recently used items and remove items until we hit the cache limit if set.
Changelog:
2011-04-04 Andrew Su <asu at redhat.com>
* netx/net/sourceforge/jnlp/cache/CacheEntry.java:
(markForDelete, lock, unlock): New methods.
* netx/net/sourceforge/jnlp/cache/CacheUtil.java:
(getCacheFile): Changed to look for most recently used item, and when
not found create a new entry.
(makeNewCacheFile, cleanCache, lockFile, unlockFile,
lockRecentlyUsedFile, unlockRecentlyUsedFile): New methods.
* netx/net/sourceforge/jnlp/cache/ResourceTracker.java:
(downloadResource): Changed to wait if we are already downloading the
file. If file downloaded is compressed, mark compressed and extracted
files for delete at shutdown.
(initializeResource): Added checks for when the cache needs updating
to create new folder entry.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
(JNLPClassLoader): Change order so that we get resources first then
check permissions for the jars.
* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java:
(markNetxRunning): Add call to clean up cache directory.
* netx/net/sourceforge/jnlp/util/FileUtils.java:
(getFileLock): New method.
Any questions or comments welcome.
Cheers,
Andrew
More information about the distro-pkg-dev
mailing list