Search in sources :

Example 16 with SharedClassURLHelper

use of com.ibm.oti.shared.SharedClassURLHelper in project openj9 by eclipse.

the class CustomURLClassLoaderNonConfirming method getURLHelper.

public void getURLHelper() throws Exception {
    SharedClassHelperFactory schFactory = Shared.getSharedClassHelperFactory();
    SharedClassURLHelper newHelper = null;
    newHelper = schFactory.getURLHelper(this);
}
Also used : SharedClassURLHelper(com.ibm.oti.shared.SharedClassURLHelper) SharedClassHelperFactory(com.ibm.oti.shared.SharedClassHelperFactory)

Example 17 with SharedClassURLHelper

use of com.ibm.oti.shared.SharedClassURLHelper in project openj9 by eclipse.

the class CDSHookImpls method classLoaderCreated.

public void classLoaderCreated(ModuleClassLoader classLoader) {
    // try to get the url helper for this class loader
    if (factory == null) {
        return;
    }
    CDSBundleFile hostFile = null;
    try {
        SharedClassURLHelper urlHelper = factory.getURLHelper(classLoader);
        boolean minimizeSucceeded = runMinimizeMethod(urlHelper);
        // set the url helper for the host base CDSBundleFile
        hostFile = getCDSBundleFile(classLoader.getClasspathManager().getGeneration().getBundleFile());
        if (hostFile != null) {
            hostFile.setURLHelper(urlHelper);
            if (minimizeSucceeded) {
                /* In Java6, there is no longer a requirement to "prime" plugins */
                hostFile.setPrimed(true);
            }
        }
    } catch (HelperAlreadyDefinedException e) {
    // We should never get here.
    // If we do, we simply won't share for this ClassLoader
    }
}
Also used : SharedClassURLHelper(com.ibm.oti.shared.SharedClassURLHelper) HelperAlreadyDefinedException(com.ibm.oti.shared.HelperAlreadyDefinedException)

Example 18 with SharedClassURLHelper

use of com.ibm.oti.shared.SharedClassURLHelper in project openj9 by eclipse.

the class CDSHookImpls method wrapBundleFile.

// ////////////// BundleFileWrapperFactoryHook //////////////
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) {
    // wrap the real bundle file for purposes of loading shared classes.
    CDSBundleFile newBundleFile;
    if (!base && generation.getBundleInfo().getBundleId() != 0) {
        // initialize the urlHelper from the base one.
        SharedClassURLHelper urlHelper = null;
        BundleFile baseFile = generation.getBundleFile();
        if ((baseFile = getCDSBundleFile(baseFile)) != null) {
            urlHelper = ((CDSBundleFile) baseFile).getURLHelper();
        }
        newBundleFile = new CDSBundleFile(bundleFile, urlHelper);
    } else {
        newBundleFile = new CDSBundleFile(bundleFile);
    }
    return newBundleFile;
}
Also used : SharedClassURLHelper(com.ibm.oti.shared.SharedClassURLHelper) BundleFile(org.eclipse.osgi.storage.bundlefile.BundleFile)

Aggregations

SharedClassURLHelper (com.ibm.oti.shared.SharedClassURLHelper)18 SharedClassHelperFactory (com.ibm.oti.shared.SharedClassHelperFactory)14 HelperAlreadyDefinedException (com.ibm.oti.shared.HelperAlreadyDefinedException)5 IOException (java.io.IOException)5 MalformedURLException (java.net.MalformedURLException)4 BundleFile (org.eclipse.osgi.storage.bundlefile.BundleFile)1