Equinox: Configure parent classloader

Source: Internet
Author: User

You can modify the startup osgi. parentclassloader to change this parent classloaer. The default value is boot.
Optional values include app, ext, and fwk.
Systemclassloader corresponding to the app. That is, the system class loader.
EXT corresponds to the parent of systemclassloader, that is, the extended class loader.
Fwk corresponds to the classloader that starts equinox.

You can see the following code in org. Eclipse. osgi. baseadaptor. baseadaptor:

// System property used to set the parent classloader type (boot is the default)
Private Static final string prop_parent_classloader = "osgi. parentclassloader"; // $ NON-NLS-1 $
// A parent classloader type that specifies the application classloader
Private Static final string parent_classloader_app = "app"; // $ NON-NLS-1 $
// A parent classloader type that specifies the extension classlaoder
Private Static final string parent_classloader_ext = "Ext"; // $ NON-NLS-1 $
// A parent classloader type that specifies the boot classlaoder
Private Static final string parent_classloader_boot = "Boot"; // $ NON-NLS-1 $
// A parent classloader type that specifies the framework classlaoder
Private Static final string parent_classloader_fwk = "fwk"; // $ NON-NLS-1 $
// The bundleclassloader parent to use when creating bundleclassloaders.
Private Static classloader bundleclassloaderparent;
Static {
// Check property for specified parent
String type = frameworkproperties. getproperty (baseadaptor. prop_parent_classloader, baseadaptor. parent_classloader_boot );
If (baseadaptor. parent_classloader_fwk.equalsignorecase (type ))
Bundleclassloaderparent = frameworkadaptor. Class. getclassloader ();
Else if (baseadaptor. parent_classloader_app.equalsignorecase (type ))
Bundleclassloaderparent = classloader. getsystemclassloader ();
Else if (baseadaptor. parent_classloader_ext.equalsignorecase (type )){
Classloader appcl = classloader. getsystemclassloader ();
If (appcl! = NULL)
Bundleclassloaderparent = appcl. getparent ();
}
// Default to boot classloader
If (bundleclassloaderparent = NULL)
Bundleclassloaderparent = new parentclassloader ();
}

// Empty parent classloader. This is used by default as the bundleclassloader parent.
Private Static class parentclassloader extends classloader {
Protected parentclassloader (){
Super (null );
}
}
 
Modify the configuration. You can do a small experiment debugging in eclipse.
Run invocations ---> arguments000> VM arguments
For example, add:
-Dosgi. parentclassloader = ext

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.