Package org.jppf.server.node
Class AbstractClassLoaderManager<N extends JPPFNode>
java.lang.Object
org.jppf.server.node.AbstractClassLoaderManager<N>
- Type Parameters:
N- the type of node.
Instances of this class manage the node's class loader and associated operations.
- Author:
- Laurent Cohen
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractClassLoaderManager(N node) Default constructor for class loader manager. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclearContainer(JPPFContainer container) Clear the specified container and cleanup its class loader.voidClear all containers associated with applications uuids.voidClear the resource caches of all class loaders managed by this object.voidClose main class loader for the node.protected abstract AbstractJPPFClassLoaderCreate the main class loader for the node.Get the main classloader for the node.getContainer(List<String> uuidPath, boolean clientAccess, Object... params) Get a reference to the JPPF container associated with an application uuid.getContainer(List<String> uuidPath, Object... params) Get a reference to the JPPF container associated with an application uuid.protected abstract Callable<AbstractJPPFClassLoader>newClassLoaderCreator(List<String> uuidPath, Object... params) Instantiate the callback used to create the class loader in eachJPPFContainer.protected AbstractJPPFClassLoadernewClientClassLoader(List<String> uuidPath, Object... params) Create a new client class loader instance for the specified uuid path.protected abstract JPPFContainernewJPPFContainer(List<String> uuidPath, AbstractJPPFClassLoader cl, boolean clientAccess) Create a new container based on the uuid path and class loader.resetClassLoader(List<String> uuidPath, Object... params) Reset the class loader specified by its uuid path.voidSet the main class loader for the node.
-
Field Details
-
node
The associated node.
-
-
Constructor Details
-
AbstractClassLoaderManager
Default constructor for class loader manager.- Parameters:
node- the associated node.
-
-
Method Details
-
getClassLoader
Get the main classloader for the node. This method performs a lazy initialization of the classloader.- Returns:
- a
ClassLoaderused for loading the classes of the framework.
-
createClassLoader
Create the main class loader for the node.- Returns:
- a
JPPFClassLoaderinstance.
-
setClassLoader
Set the main class loader for the node.- Parameters:
cl- the class loader to set.
-
closeClassLoader
public void closeClassLoader()Close main class loader for the node. -
getContainer
Get a reference to the JPPF container associated with an application uuid.- Parameters:
uuidPath- the uuid path containing the key to the container.params- a (possibly empty) set of arbitrary parameters to propagate to the class loader.- Returns:
- a
JPPFContainerinstance. - Throws:
Exception- if an error occurs while getting the container.
-
getContainer
public JPPFContainer getContainer(List<String> uuidPath, boolean clientAccess, Object... params) throws Exception Get a reference to the JPPF container associated with an application uuid.- Parameters:
uuidPath- the uuid path containing the key to the container.clientAccess- whether the node has access to the client that submitted the job.params- a (possibly empty) set of arbitrary parameters to propagate to the class loader.- Returns:
- a
JPPFContainerinstance. - Throws:
Exception- if an error occurs while getting the container.
-
newClientClassLoader
Create a new client class loader instance for the specified uuid path.- Parameters:
uuidPath- the uuid path uniquely identifying the client.params- a (possibly empty) set of arbitrary parameters to propagate to the class loader.- Returns:
- a
AbstractJPPFClassLoaderinstance ornullif the class laoder could not be created.
-
clearContainers
public void clearContainers()Clear all containers associated with applications uuids. -
clearContainer
Clear the specified container and cleanup its class loader.- Parameters:
container- th container to clean up.
-
newJPPFContainer
protected abstract JPPFContainer newJPPFContainer(List<String> uuidPath, AbstractJPPFClassLoader cl, boolean clientAccess) throws Exception Create a new container based on the uuid path and class loader.- Parameters:
uuidPath- uuid path for the corresponding client.cl- the class loader to use.clientAccess- whether the node has access to the client that submitted the job.- Returns:
- a
JPPFContainerinstance. - Throws:
Exception- if any error occurs.
-
newClassLoaderCreator
protected abstract Callable<AbstractJPPFClassLoader> newClassLoaderCreator(List<String> uuidPath, Object... params) Instantiate the callback used to create the class loader in eachJPPFContainer.- Parameters:
uuidPath- the uuid path containing the key to the container.params- a (possibly empty) set of arbitrary parameters to propagate to the class loader.- Returns:
- a
Callableinstance.
-
clearResourceCaches
public void clearResourceCaches()Clear the resource caches of all class loaders managed by this object. -
resetClassLoader
public AbstractJPPFClassLoader resetClassLoader(List<String> uuidPath, Object... params) throws Exception Reset the class loader specified by its uuid path.- Parameters:
uuidPath- uuid path of the class loader to reset.params- a (possibly empty) set of arbitrary parameters to propagate to the class loader.- Returns:
- the new created class loader istance.
- Throws:
Exception- if any error occurs.
-