On 10/27/2014 9:38 PM, Ioi Lam wrote:

What I request to add is a test setting the system property (-Dsun.cds.enableSharedLookupCache=true) and continue to load class A and B. Removing line 44-58 should do it and also no need to set -Dfoo.foo.bar.

Do you mean change the test to call System.setProperty("sun.cds.enableSharedLookupCache", "true")?

But we know that the property is checked only once, before any app classes are loaded. So calling System.setProperty in an application class won't test anything.

No, set it in the command-line (i.e. @run) is fine.

Removing line 44-58  should do it.

It'd be good if you run this test and turn on the debug traces to make sure that the application class loader and ext class loader will start up with the lookup cache enabled and make up call to the VM. As it doesn't have the app cds archive, it will invalidate the cache right away and continue the class lookup with null cache array.
In the latest code, if CDS is not available, lookupCacheEnabled will be set to false inside the static initializer of URLClassPath:

    private static volatile boolean lookupCacheEnabled
= "true".equals(VM.getSavedProperty("sun.cds.enableSharedLookupCache"));

later, when the boot/ext/app loaders call into here:

    synchronized void initLookupCache(ClassLoader loader) {
        if ((lookupCacheURLs = getLookupCacheURLs(loader)) != null) {
            lookupCacheLoader = loader;
        } else {
            // This JVM instance does not support lookup cache.
            disableAllLookupCaches();
        }
    }

their lookupCacheURLs[] fields will all be set to null. As a result, getLookupCacheForClassLoader and knownToNotExist0 will never be called.


It will call getLookupCacheURLs. It's just a sanity test and it's fine to call one but not all three.

I can add a DEBUG_LOOKUP_CACHE trace inside disableAllLookupCaches to print "lookup cache disabled", and check for that in the test. Is this OK?

As long as A.test and B.test are invoked and finishes, it should be adequate.

Mandy

Reply via email to