Mercurial > hg > release > icedtea7-2.6
changeset 1999:d38d3977ca3e
Make child JNLPs use the same classloader as parent for a given instance.
2009-08-25 Deepak Bhole <dbhole@redhat.com>
* netx/net/sourceforge/jnlp/JNLPFile.java: Add a new key variable that is
unique to each instance.
(JNLPFile): Existing constructor changed to generate a new key on call.
(JNLPFile): New constructor that takes a key. If called, sets the file's
key to it.
(getUniqueKey): Returns the unique key for the instance.
* netx/net/sourceforge/jnlp/PluginBridge.java: Generate new instance
specific unique key.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
(getInstance): Use unique instance keys to determine which classloader to
use, rather than using the URL.
(getInstance): Same.
(initializeExtensions): Provide unique key to getInstance.
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Tue, 06 Oct 2009 18:01:08 +0100 |
parents | e0f4520ae470 |
children | dbe859b50636 |
files | ChangeLog netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/PluginBridge.java netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |
diffstat | 4 files changed, 111 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Aug 14 15:58:42 2009 -0400 +++ b/ChangeLog Tue Oct 06 18:01:08 2009 +0100 @@ -1,4 +1,20 @@ -2009-08-14 Deepak Bhole <dbhole@redhat.com> +2009-08-25 Deepak Bhole <dbhole@redhat.com> + + * netx/net/sourceforge/jnlp/JNLPFile.java: Add a new key variable that is + unique to each instance. + (JNLPFile): Existing constructor changed to generate a new key on call. + (JNLPFile): New constructor that takes a key. If called, sets the file's + key to it. + (getUniqueKey): Returns the unique key for the instance. + * netx/net/sourceforge/jnlp/PluginBridge.java: Generate new instance + specific unique key. + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java + (getInstance): Use unique instance keys to determine which classloader to + use, rather than using the URL. + (getInstance): Same. + (initializeExtensions): Provide unique key to getInstance. + +2009-08-14 Deepak Bhole <dbhole@redhat.com> * plugin/icedteanp/IcedTeaJavaRequestProcessor.cc (newMessageOnBus): Handle additional request types. @@ -56,14 +72,14 @@ (setMember): Same. (convertToNPVariant): New function. Narrows given java type to an NPVariant as per type conversion specifications. - (sendMember): Remove unnecessary heap allocations and use function stack + (sendMember): Remove unnecessary heap allocations and use function stack instead. (storeVariantInJava): New function. Given an NPVariant, does the appropriate conversion and saves it on the Java side. Arrays are not yet handled. (_eval): New function. Evaluates the script via NPN_Evaluate. Meant to be run in the main thread. - (_call): New function. Invokes the function via NPN_Invoke. Meant to be run + (_call): New function. Invokes the function via NPN_Invoke. Meant to be run in the main thread. * plugin/icedteanp/IcedTeaPluginRequestProcessor.h: Appropriate changes as necessitated by the above changes in the .cc. @@ -81,7 +97,7 @@ (getInstanceFromMemberPtr): Moved from IcedTeaPluginRequestProcessor. Given an NPObject, returns the associated instance. (variantToClassName): Remove unused method. - * plugin/icedteanp/IcedTeaPluginUtils.h: Appropriate changes as necessitated + * plugin/icedteanp/IcedTeaPluginUtils.h: Appropriate changes as necessitated by the above changes in the .cc. * plugin/icedteanp/IcedTeaRunnable.cc (IcedTeaRunnableMethod): Change result parameter type to void* so that caller/callee can use variable @@ -151,7 +167,7 @@ readded during the reorganisation. Shift BOOTSTRAPPING conditional to top with other conditionals. - + 2009-10-02 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: @@ -164,7 +180,7 @@ * NEWS: Updated with Makefile changes. - + 2009-10-01 Andrew John Hughes <ahughes@redhat.com> Reorganise Makefile and rename some @@ -324,7 +340,7 @@ 2009-09-23 Jon VanAlten <jon.vanalten@redhat.com> * Makefile.am: - Build PulseAudio class files into distinct subdirectory. + Build PulseAudio class files into distinct subdirectory. 2009-09-04 Andrew John Hughes <ahughes@redhat.com> @@ -426,12 +442,12 @@ * Makefile.am: Bump to b67. - + 2009-08-06 Matthias Klose <doko@ubuntu.com> * Makefile.am (ICEDTEA_ENV, ICEDTEA_ENV_ECJ): Allow passing as environment. - + 2009-08-06 Matthias Klose <doko@ubuntu.com> * Makefile.am (ICEDTEA_PATCHES): Make $(DISTRIBUTION_PATCHES) the @@ -488,7 +504,7 @@ * Makefile.am: Remove IcedTeaNPPlugin.cc from EXTRA_DIST as now under plugin directory tree. - + 2009-08-04 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: @@ -566,7 +582,7 @@ * patches/icedtea-webstart.patch, * patches/icedtea-liveconnect.patch: Recreated against OpenJDK7. - + 2009-06-05 Omair Majid <omajid@redhat.com> * patches/icedtea-webstart.patch: Make javax.jnlp package visible to @@ -596,10 +612,10 @@ (checkAccess): New function. (checkAccess): Add a new argument app. * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java - (getLockFileName): Call FileUtils.sanitizeFileName to sanitize the + (getLockFileName): Call FileUtils.sanitizeFileName to sanitize the filename. * netx/net/sourceforge/jnlp/util/FileUtils.java: New file. - * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: New file. + * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: New file. 2009-07-29 Omair Majid <omajid@redhat.com>
--- a/netx/net/sourceforge/jnlp/JNLPFile.java Fri Aug 14 15:58:42 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Tue Oct 06 18:01:08 2009 +0100 @@ -23,6 +23,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -66,6 +67,9 @@ /** the network location of this JNLP file */ protected URL fileLocation; + + /** A key that uniquely identifies connected instances (main jnlp+ext) */ + protected String uniqueKey = null; /** the URL used to resolve relative URLs in the file */ protected URL codeBase; @@ -171,6 +175,33 @@ parse(root, strict, location); this.fileLocation = location; + + this.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" + + Math.abs(((new java.util.Random()).nextInt())) + "-" + + location; + + if (JNLPRuntime.isDebug()) + System.err.println("UNIQUEKEY=" + this.uniqueKey); + } + + /** + * Create a JNLPFile from a URL, parent URLm a version and checking for + * updates using the specified policy. + * + * @param location the location of the JNLP file + * @param uniqueKey A string that uniquely identifies connected instances + * @param version the version of the JNLP file + * @param strict whether to enforce the spec when + * @param policy the update policy + * @throws IOException if an IO exception occurred + * @throws ParseException if the JNLP file was invalid + */ + public JNLPFile(URL location, String uniqueKey, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException { + this(location, version, strict, policy); + this.uniqueKey = uniqueKey; + + if (JNLPRuntime.isDebug()) + System.err.println("UNIQUEKEY (override) =" + this.uniqueKey); } /** @@ -248,6 +279,13 @@ } /** + * Returns the location of the parent file if it exists, null otherwise + */ + public String getUniqueKey() { + return uniqueKey; + } + + /** * Returns the JNLP file's version. */ public Version getFileVersion() {
--- a/netx/net/sourceforge/jnlp/PluginBridge.java Fri Aug 14 15:58:42 2009 -0400 +++ b/netx/net/sourceforge/jnlp/PluginBridge.java Tue Oct 06 18:01:08 2009 +0100 @@ -24,6 +24,7 @@ import java.net.URL; import java.net.MalformedURLException; +import java.util.Calendar; import java.util.Hashtable; import java.util.Locale; import java.util.List; @@ -103,7 +104,10 @@ codebase.getHost()); else security = null; - + + this.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" + + Math.abs(((new java.util.Random()).nextInt())) + "-" + + documentBase; } public String getTitle()
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Fri Aug 14 15:58:42 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Oct 06 18:01:08 2009 +0100 @@ -209,15 +209,45 @@ * @param policy the update policy to use when downloading resources */ public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy) throws LaunchException { + JNLPClassLoader baseLoader = null; JNLPClassLoader loader = null; - URL location = file.getFileLocation(); + String uniqueKey = file.getUniqueKey(); - if (location != null) - loader = (JNLPClassLoader) urlToLoader.get(location); + if (uniqueKey != null) + baseLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey); try { - if (loader == null) - loader = new JNLPClassLoader(file, policy); + + // If base loader is null, or the baseloader's file and this + // file is different, initialize a new loader + if (baseLoader == null || + !baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation())) { + loader = new JNLPClassLoader(file, policy); + // New loader init may have caused extentions to create a + // loader for this unique key. Check. + JNLPClassLoader extLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey); + + if (extLoader != null) { + for (URL u : loader.getURLs()) + extLoader.addURL(u); + + loader = extLoader; + } + + // loader is now current + ext. But we also need to think of + // the baseLoader + if (baseLoader != null) { + for (URL u : loader.getURLs()) + baseLoader.addURL(u); + + loader = baseLoader; + } + + } else { + // if key is same and locations match, this is the loader we want + loader = baseLoader; + } + } catch (LaunchException e) { throw e; } @@ -236,12 +266,12 @@ * @param version the file's version * @param policy the update policy to use when downloading resources */ - public static JNLPClassLoader getInstance(URL location, Version version, UpdatePolicy policy) + public static JNLPClassLoader getInstance(URL location, String uniqueKey, Version version, UpdatePolicy policy) throws IOException, ParseException, LaunchException { - JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location); + JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(uniqueKey); - if (loader == null) - loader = getInstance(new JNLPFile(location, version, false, policy), policy); + if (loader == null || !location.equals(loader.getJNLPFile().getFileLocation())) + loader = getInstance(new JNLPFile(location, uniqueKey, version, false, policy), policy); return loader; }