Class ClassLoaderHierarchyImpl

    • Constructor Detail

      • ClassLoaderHierarchyImpl

        public ClassLoaderHierarchyImpl()
    • Method Detail

      • getAPIClassLoader

        public ClassLoader getAPIClassLoader()
        Description copied from interface: ClassLoaderHierarchy
        Returns a ClassLoader that can load classes exported by any OSGi bundle in the system for public use. Such classes include Java EE API, AMX API, appserv-ext API, etc. CommonClassLoader delegates to this class loader.
        Specified by:
        getAPIClassLoader in interface ClassLoaderHierarchy
        Returns:
        a ClassLoader that can load classes exported by any bundles
      • getCommonClassLoader

        public CurrentBeforeParentClassLoader getCommonClassLoader()
        Description copied from interface: ClassLoaderHierarchy
        Returns a class loader that is common to all deployed applications. Common Class Loader is responsible for loading classes from following URLs (the order is strictly maintained): lib/*.jar:domain_dir/lib/classes:domain_dir/lib/*.jar. Please note that domain_dir/lib/classes comes before domain_dir/lib/*.jar, just like WEB-INF/classes is searched first before WEB-INF/lib/*.jar. It delegates to APIClassLoader.
        Specified by:
        getCommonClassLoader in interface ClassLoaderHierarchy
        Returns:
        ClassLoader common to all deployed applications.
        See Also:
        ClassLoaderHierarchy.getAPIClassLoader()
      • getConnectorClassLoader

        public DelegatingClassLoader getConnectorClassLoader​(String application)
        Description copied from interface: ClassLoaderHierarchy
        Returns the class loader which has visibility to appropriate list of standalone RARs deployed in the server. Depending on a policy, this can either return a singleton classloader for all applications or a class loader specific to an application. When a singleton class loader is returned, such a class loader will have visibility to all the standalone RARs deployed in the system. When a class loader specific to an application is returned, such a class loader will have visibility to only standalone RARs that the application depends on.
        Specified by:
        getConnectorClassLoader in interface ClassLoaderHierarchy
        Parameters:
        application - Application whose class loader hierarchy is being set
        Returns:
        class loader which has visibility to appropriate list of standalone RARs.
      • getAppLibClassLoader

        public ClassLoader getAppLibClassLoader​(String application,
                                                List<URI> libURIs)
                                         throws MalformedURLException
        Description copied from interface: ClassLoaderHierarchy
        Returns AppLibClassLoader. As the name suggests, this class loader has visibility to deploy time libraries (--libraries and EXTENSION_LIST of MANIFEST.MF, provided the library is available in 'applibs' directory) for an application. It is different from CommonClassLoader in a sense that the libraries that are part of common class loader are shared by all applications, where as this class loader adds a scope to a library.
        Specified by:
        getAppLibClassLoader in interface ClassLoaderHierarchy
        Parameters:
        application - Application for which this class loader is created
        libURIs - list of URIs, where each URI represent a library
        Returns:
        class loader that has visibility to appropriate application specific libraries.
        Throws:
        MalformedURLException
        See Also:
        #getAppLibClassFinder(List)
      • getAppLibClassFinder

        public DelegatingClassLoader.ClassFinder getAppLibClassFinder​(List<URI> libURIs)
                                                               throws MalformedURLException
        Description copied from interface: ClassLoaderHierarchy
        Returns ApplibClassFinder. As the name suggests, this class finder has visibility to deploy time libraries (--libraries and EXTENSION_LIST of MANIFEST.MF, provided the library is available in 'applibs' directory) for an application. It is different from CommonClassLoader in a sense that the libraries that are part of common class loader are shared by all applications, where as this class loader adds a scope to a library.
        NOTE : Difference between this API and getAppLibClassLoader(String, List<URI>) is the latter will be used by all applications (for its parent classloader) whereas this API will be used only by connector classloader. All other application classloaders will have AppLibClassLoader as parent where as connector classloader will be above AppLibClassLoader and hence simple delegation is not feasible.
        Specified by:
        getAppLibClassFinder in interface ClassLoaderHierarchy
        Parameters:
        libURIs - list of URIs, where each URI represent a library
        Returns:
        class loader that has visibility to appropriate application specific libraries.
        Throws:
        MalformedURLException
        See Also:
        #getAppLibClassLoader(String, List)
      • createApplicationParentCL

        public ClassLoader createApplicationParentCL​(ClassLoader parent,
                                                     DeploymentContext context)
                                              throws com.sun.enterprise.module.ResolveError
        Sets up the parent class loader for the application class loader. Application class loader are under the control of the ArchiveHandler since a special archive file format will require a specific class loader. However GlassFish needs to be able to add capabilities to the application like adding APIs accessibility, this is done through its parent class loader which we create and maintain.
        Specified by:
        createApplicationParentCL in interface ClassLoaderHierarchy
        Parameters:
        parent - the parent class loader
        context - deployment context
        Returns:
        class loader capable of loading public APIs identified by the deployers
        Throws:
        com.sun.enterprise.module.ResolveError - if one of the deployer's public API module is not found.