|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.core.pc.plugin.ClassLoaderManager
public class ClassLoaderManager
Manages the classloaders created and used by the plugin container and all plugins/resources.
| Constructor Summary | |
|---|---|
ClassLoaderManager(Map<String,URL> pluginNamesUrls,
PluginDependencyGraph graph,
ClassLoader rootClassLoader,
File tmpDir,
boolean createResourceClassLoaders)
Creates the object that will manage all classloaders for the plugins deployed in the given plugin deployment graph. |
|
| Method Summary | |
|---|---|
void |
destroy()
Cleans up this object and all classloaders it has created. |
Map<String,ClassLoader> |
getDiscoveryClassLoaders()
Returns a shallow copy of the discovery classloaders keyed on a hash calculated from plugin name and parent classloader. |
int |
getNumberOfDiscoveryClassLoaders()
Returns the total number of discovery classloaders that have been created and managed. |
int |
getNumberOfPluginClassLoaders()
Returns the total number of plugin classloaders that have been created and managed. |
int |
getNumberOfResourceClassLoaders()
Returns the total number of resource classloaders that have been created and managed. |
Map<String,ClassLoader> |
getPluginClassLoaders()
Returns a shallow copy of the plugin classloaders keyed on plugin name. |
PluginDependencyGraph |
getPluginDependencyGraph()
Returns the graph of all the plugins and their dependencies. |
Map<CanonicalResourceKey,ClassLoader> |
getResourceClassLoaders()
Returns a shallow copy of the resource classloaders keyed on a canonical keys. |
ClassLoader |
getRootClassLoader()
Returns the classloader that should be the ancestor (i.e. |
boolean |
isCreateResourceClassLoaders()
Returns true if this manager will create instances of classloaders for those
individual Resources that require it, or false if this manager will never create
individual classloaders for Resources (i.e. |
ClassLoader |
obtainDiscoveryClassLoader(String pluginName,
ClassLoader parentClassLoader)
Similar to obtainPluginClassLoader(String), however, the classloader to be returned
will have the given parent classloader (as opposed to having parent classloaders that follow the
plugin dependency graph hierarchy). |
ClassLoader |
obtainPluginClassLoader(String pluginName)
Returns a plugin classloader (creating it if necessary) that contains the plugin jar and whose parent classloader is that of the the classloader for the required (<depends>) plugin. |
ClassLoader |
obtainResourceClassLoader(org.rhq.core.domain.resource.Resource resource,
ResourceContainer parent,
List<URL> additionalJars)
Returns the classloader that the given resource should use when being invoked. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ClassLoaderManager(Map<String,URL> pluginNamesUrls,
PluginDependencyGraph graph,
ClassLoader rootClassLoader,
File tmpDir,
boolean createResourceClassLoaders)
pluginNamesUrls - maps a plugin name with the URL to that plugin's jar filegraph - the graph that provides plugin dependency information for all plugins that are deployedrootClassLoader - the classloader at the top of the classloader hierarchy to be used as the parent classloader
for those classloaders that are not children to other shared/resource classloaders.tmpDir - where the classloaders can write out the jars that are embedded in the plugin jarscreateResourceClassLoaders - if true, the classloader manager will create resource classloader
instances when appropriate. If false, this classloader manager
will never create classloaders on a per-resource instance basis. It will only
ever create and return plugin classloaders. This will be false when
the plugin container is running embedded inside a managed resource and that
managed resource will provide the necessary client jars via the root classloader.| Method Detail |
|---|
public void destroy()
public String toString()
toString in class Objectpublic ClassLoader getRootClassLoader()
public PluginDependencyGraph getPluginDependencyGraph()
public ClassLoader obtainPluginClassLoader(String pluginName)
throws PluginContainerException
dependency graph.
pluginName - the plugin whose classloader is to be created
PluginContainerException
public ClassLoader obtainDiscoveryClassLoader(String pluginName,
ClassLoader parentClassLoader)
throws PluginContainerException
obtainPluginClassLoader(String), however, the classloader to be returned
will have the given parent classloader (as opposed to having parent classloaders that follow the
plugin dependency graph hierarchy). This is used to support loading discovery components where
those discovery components need to use connections to the parent resource in order to perform their
discovery.
pluginName - the name of the plugin where the discovery component can be foundparentClassLoader - the parent classloader of the new classloader being created
PluginContainerException
public ClassLoader obtainResourceClassLoader(org.rhq.core.domain.resource.Resource resource,
ResourceContainer parent,
List<URL> additionalJars)
throws PluginContainerException
null; if it is, the caller should
just assume the resource is the top-level platform and just get that platform resource's
plugin classloader.
resource - the resource whose classloader is to be obtainedparent - the container for the parent of the given resource (must never be null)additionalJars - additional jars to put into the classloader
PluginContainerExceptionpublic int getNumberOfPluginClassLoaders()
public int getNumberOfDiscoveryClassLoaders()
public int getNumberOfResourceClassLoaders()
public Map<String,ClassLoader> getPluginClassLoaders()
obtainPluginClassLoader(String).
null)public Map<String,ClassLoader> getDiscoveryClassLoaders()
obtainDiscoveryClassLoader(String, ClassLoader).
null)public Map<CanonicalResourceKey,ClassLoader> getResourceClassLoaders()
obtainResourceClassLoader(Resource, ResourceContainer, List).
null)public boolean isCreateResourceClassLoaders()
true if this manager will create instances of classloaders for those
individual Resources that require it, or false if this manager will never create
individual classloaders for Resources (i.e. obtainResourceClassLoader(Resource, ResourceContainer, List)
will always just return plugin classloaders).
true if this manager will create instances of classloaders for those
individual Resources that require it, or false if this manager will never create
individual classloaders for Resources (i.e. obtainResourceClassLoader(Resource, ResourceContainer, List)
will always just return plugin classloaders)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||