Class AbstractClassLoaderManager<N extends JPPFNode>

java.lang.Object
org.jppf.server.node.AbstractClassLoaderManager<N>
Type Parameters:
N - the type of node.

public abstract class AbstractClassLoaderManager<N extends JPPFNode> extends Object
Instances of this class manage the node's class loader and associated operations.
Author:
Laurent Cohen
  • Field Details

    • node

      protected final N extends JPPFNode node
      The associated node.
  • Constructor Details

    • AbstractClassLoaderManager

      protected AbstractClassLoaderManager(N node)
      Default constructor for class loader manager.
      Parameters:
      node - the associated node.
  • Method Details

    • getClassLoader

      public AbstractJPPFClassLoader getClassLoader()
      Get the main classloader for the node. This method performs a lazy initialization of the classloader.
      Returns:
      a ClassLoader used for loading the classes of the framework.
    • createClassLoader

      protected abstract AbstractJPPFClassLoader createClassLoader()
      Create the main class loader for the node.
      Returns:
      a JPPFClassLoader instance.
    • setClassLoader

      public void setClassLoader(AbstractJPPFClassLoader cl)
      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

      public JPPFContainer getContainer(List<String> uuidPath, 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.
      params - a (possibly empty) set of arbitrary parameters to propagate to the class loader.
      Returns:
      a JPPFContainer instance.
      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 JPPFContainer instance.
      Throws:
      Exception - if an error occurs while getting the container.
    • newClientClassLoader

      protected AbstractJPPFClassLoader newClientClassLoader(List<String> uuidPath, Object... params)
      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 AbstractJPPFClassLoader instance or null if the class laoder could not be created.
    • clearContainers

      public void clearContainers()
      Clear all containers associated with applications uuids.
    • clearContainer

      protected void clearContainer(JPPFContainer container)
      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 JPPFContainer instance.
      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 each JPPFContainer.
      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 Callable instance.
    • 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.