public class RegionClassLoader extends MuleDeployableArtifactClassLoader
ArtifactClassLoaderFilter. Lookup policy for each classloader added to the region must be aware of any
dependency between members of the region and updated accordingly.
For any member X of the region, if it has a dependency against another region member Y, then X must add all the exported
packages from Y as PARENT_FIRST. (to indicate that X wants to load those Y's packages)
For any member X of the region, if there is another region member Y that is not a dependency, then X must add all the exported
packages from Y as CHILD_ONLY. (to indicate that X does not want to load those Y's packages)
Only a region member can export a given package, but same resources can be exported by many members. The order in which the
resources are found will depend on the order in which the class loaders were added to the region.FineGrainedControlClassLoader.NonCachingURLStreamHandlerFactory| Modifier and Type | Field and Description |
|---|---|
protected static String |
REGION_OWNER_CANNOT_BE_REMOVED_ERROR |
shutdownListeners| Constructor and Description |
|---|
RegionClassLoader(String artifactId,
ArtifactDescriptor artifactDescriptor,
ClassLoader parent,
ClassLoaderLookupPolicy lookupPolicy)
Creates a new region.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClassLoader(ArtifactClassLoader artifactClassLoader,
ArtifactClassLoaderFilter filter)
Adds a class loader to the region.
|
void |
dispose()
Disposes the
ClassLoader by closing all the resources opened by this ClassLoader. |
Class<?> |
findLocalClass(String name)
Loads the class with the specified binary name if defined on this class loader.
|
URL |
findLocalResource(String resourceName)
This method finds a resource in the local environment for this artifact, if the resource is not found and the artifact has a
parent artifact then the operation is resolved by that parent, if there is no parent, the resources is searched in the global
environment.
|
URL |
findResource(String name) |
Enumeration<URL> |
findResources(String name)
Returns an enumeration of
URL objects representing all the resources with the given name which
are local to the classloader |
List<ArtifactClassLoader> |
getArtifactPluginClassLoaders()
Provides a
List with the plugin name as key and its classloader as value. |
boolean |
removeClassLoader(ArtifactClassLoader artifactClassLoader)
Removes a class loader member from the region.
|
String |
toString() |
addShutdownListener, createResourceReleaserInstance, getArtifactDescriptor, getArtifactId, getClassLoader, getLocalResourceLocations, setResourceReleaserClassLocationfindParentClass, getClassLoaderLookupPolicy, getResource, getResources, loadClassaddURL, close, definePackage, findClass, getPermissions, getResourceAsStream, getURLs, newInstance, newInstancedefineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignersclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetClassLoaderLookupPolicyprotected static final String REGION_OWNER_CANNOT_BE_REMOVED_ERROR
public RegionClassLoader(String artifactId, ArtifactDescriptor artifactDescriptor, ClassLoader parent, ClassLoaderLookupPolicy lookupPolicy)
artifactId - artifact unique ID for the artifact owning the created class loader instance. Non empty.artifactDescriptor - descriptor for the artifact owning the created class loader instance. Non null.parent - parent classloader for the region. Non nulllookupPolicy - lookup policy to use on the regionpublic List<ArtifactClassLoader> getArtifactPluginClassLoaders()
MuleDeployableArtifactClassLoaderList with the plugin name as key and its classloader as value.getArtifactPluginClassLoaders in class MuleDeployableArtifactClassLoaderList of plugin class loaderspublic void addClassLoader(ArtifactClassLoader artifactClassLoader, ArtifactClassLoaderFilter filter)
artifactClassLoader - classloader to add. Non null.filter - filter used to provide access to the added classloader. Non nullIllegalArgumentException - if the class loader is already a region member.public boolean removeClassLoader(ArtifactClassLoader artifactClassLoader)
artifactClassLoader - class loader to remove. Non nullIllegalArgumentException - if the class loader is the region owner or is a regiion member that exports packages or
resources.public Class<?> findLocalClass(String name) throws ClassNotFoundException
ArtifactClassLoaderfindLocalClass in interface ArtifactClassLoaderfindLocalClass in class FineGrainedControlClassLoadername - The binary name of the classClassNotFoundException - If the class was not foundpublic final URL findResource(String name)
findResource in interface ArtifactClassLoaderfindResource in class URLClassLoadername - name of the resource to find.public final Enumeration<URL> findResources(String name) throws IOException
ArtifactClassLoaderURL objects representing all the resources with the given name which
are local to the classloaderfindResources in interface ArtifactClassLoaderfindResources in class URLClassLoadername - The resource nameURL objects for the resourcesIOException - If I/O errors occurpublic void dispose()
FineGrainedControlClassLoaderClassLoader by closing all the resources opened by this ClassLoader. See
URLClassLoader.close().dispose in interface DisposableClassLoaderdispose in class MuleArtifactClassLoaderpublic URL findLocalResource(String resourceName)
LocalResourceLocatorfindLocalResource in interface LocalResourceLocatorfindLocalResource in class MuleArtifactClassLoaderresourceName - name of the resource to find.public String toString()
toString in class MuleArtifactClassLoaderCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.