Package org.jcsp.net.dynamic
Class NodeClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- org.jcsp.net.dynamic.NodeClassLoader
-
class NodeClassLoader extends java.lang.ClassLoader
Custom class loader for retrieving class files from a JFTP process on another node. Each instance will spawn a child process that will keep running. When a class is requested from the loader, it will synchronize with the child process which will contact a JFTP process and wait for data. When the class arrives the original caller will resume and register the class. Using a separate thread allows the JFTP process to push other classes to the class loader. Any classes pushed in this manner will be registered when the next class is requested from the class loader.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NodeClassLoader.LoaderThread
Child process to communicate with the JFTP process, issuing requests to it and waiting for replies.
-
Field Summary
Fields Modifier and Type Field Description private ClassManager
classManager
The class manager responsible for managing dynamically loaded classes at this node.private One2OneChannel
classReq
Channel for passing requests from thefindClass
method to the child process.private One2OneChannel
classResp
Channel for returning data from the child process to thefindClass
method.
-
Constructor Summary
Constructors Constructor Description NodeClassLoader(NetChannelLocation sourceChannelLocation, ClassManager cm)
Constructs a newNodeClassLoader
for loading classes held by a JFTP process at another node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class
findClass(java.lang.String name)
Issues a request to the child process to get a class definition from the remote JFTP process.-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
classReq
private final One2OneChannel classReq
Channel for passing requests from thefindClass
method to the child process.
-
classResp
private final One2OneChannel classResp
Channel for returning data from the child process to thefindClass
method.
-
classManager
private final ClassManager classManager
The class manager responsible for managing dynamically loaded classes at this node.
-
-
Constructor Detail
-
NodeClassLoader
public NodeClassLoader(NetChannelLocation sourceChannelLocation, ClassManager cm)
Constructs a newNodeClassLoader
for loading classes held by a JFTP process at another node. On construction a child thread is spawned.- Parameters:
sourceChannelLocation
- location of the request channel of a remote JFTP process.cm
- class manager responsible for dynamically loaded classes at this node.
-
-
Method Detail
-
findClass
public java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
Issues a request to the child process to get a class definition from the remote JFTP process. If the JFTP process has been pushing class definitions to this node the child process may return multiple results. One of them will be the requested class. All will be registered and a note is taken of the one requested so that it can be returned.- Overrides:
findClass
in classjava.lang.ClassLoader
- Parameters:
name
- name of the class to load.- Returns:
- the class instance.
- Throws:
java.lang.ClassNotFoundException
- if the remote node did not have the class.
-
-