org.jppf.classloader
Class JPPFLocalClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.jppf.classloader.AbstractJPPFClassLoaderLifeCycle
                  extended by org.jppf.classloader.AbstractJPPFClassLoader
                      extended by org.jppf.classloader.JPPFLocalClassLoader

public class JPPFLocalClassLoader
extends AbstractJPPFClassLoader

This class is a custom class loader serving the purpose of dynamically loading the JPPF classes and the client application classes, to avoid costly redeployment system-wide.

Author:
Laurent Cohen

Nested Class Summary
protected  class JPPFLocalClassLoader.ResourceRequest
          Encapsulates a remote resource request submitted asynchronously via the single-thread executor.
 
Nested classes/interfaces inherited from class org.jppf.classloader.AbstractJPPFClassLoaderLifeCycle
AbstractJPPFClassLoaderLifeCycle.AbstractResourceRequest
 
Field Summary
 
Fields inherited from class org.jppf.classloader.AbstractJPPFClassLoaderLifeCycle
cache, dynamic, executor, INITIALIZING, LOCK, requestUuid, serializer, uuidPath
 
Constructor Summary
JPPFLocalClassLoader(ClassLoader parent, List<String> uuidPath)
          Initialize this class loader with a parent class loader.
JPPFLocalClassLoader(LocalClassLoaderChannel ioHandler, ClassLoader parent)
          Initialize this class loader with a parent class loader.
 
Method Summary
 void close()
          Terminate this classloader and clean the resources it uses.
protected  void init()
          Initialize the underlying socket connection.
 Class<?> loadJPPFClass(String name)
          Load a JPPF class from the server.
protected  JPPFResourceWrapper loadRemoteData(Map<String,Object> map, boolean asResource)
          Load the specified class from a socket connection.
 void reset()
          Reset and reinitialize the connection ot the server.
 
Methods inherited from class org.jppf.classloader.AbstractJPPFClassLoader
computeRemoteData, findClass, findMultipleResources, findResource, findResources, getMultipleResources, getResourceAsStream
 
Methods inherited from class org.jppf.classloader.AbstractJPPFClassLoaderLifeCycle
addURL, getSerializer, loadResourceData, loadResourceData0, setRequestUuid
 
Methods inherited from class java.net.URLClassLoader
definePackage, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPPFLocalClassLoader

public JPPFLocalClassLoader(LocalClassLoaderChannel ioHandler,
                            ClassLoader parent)
Initialize this class loader with a parent class loader.

Parameters:
ioHandler - wraps the communication channel with the driver.
parent - a ClassLoader instance.

JPPFLocalClassLoader

public JPPFLocalClassLoader(ClassLoader parent,
                            List<String> uuidPath)
Initialize this class loader with a parent class loader.

Parameters:
parent - a ClassLoader instance.
uuidPath - unique identifier for the submitting application.
Method Detail

init

protected void init()
Initialize the underlying socket connection.

Specified by:
init in class AbstractJPPFClassLoaderLifeCycle

reset

public void reset()
Reset and reinitialize the connection ot the server.

Specified by:
reset in class AbstractJPPFClassLoaderLifeCycle

close

public void close()
Terminate this classloader and clean the resources it uses.

Specified by:
close in class AbstractJPPFClassLoaderLifeCycle
See Also:
AbstractJPPFClassLoaderLifeCycle.close()

loadJPPFClass

public Class<?> loadJPPFClass(String name)
                       throws ClassNotFoundException
Load a JPPF class from the server.

Overrides:
loadJPPFClass in class AbstractJPPFClassLoader
Parameters:
name - the binary name of the class
Returns:
the resulting Class object
Throws:
ClassNotFoundException - if the class could not be found

loadRemoteData

protected JPPFResourceWrapper loadRemoteData(Map<String,Object> map,
                                             boolean asResource)
                                      throws Exception
Load the specified class from a socket connection.

Specified by:
loadRemoteData in class AbstractJPPFClassLoaderLifeCycle
Parameters:
map - contains the necessary resource request data.
asResource - true if the resource is loaded using getResource(), false otherwise.
Returns:
a JPPFResourceWrapper containing the resource content.
Throws:
Exception - if the connection was lost and could not be reestablished.


Copyright © 2005-2010 JPPF Team.