Package org.jcsp.net.dynamic
Class NodeClassLoader
java.lang.Object
java.lang.ClassLoader
org.jcsp.net.dynamic.NodeClassLoader
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 ClassesModifier and TypeClassDescriptionprivate static class
Child process to communicate with the JFTP process, issuing requests to it and waiting for replies. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassManager
The class manager responsible for managing dynamically loaded classes at this node.private final One2OneChannel
Channel for passing requests from thefindClass
method to the child process.private final One2OneChannel
Channel for returning data from the child process to thefindClass
method. -
Constructor Summary
ConstructorsConstructorDescriptionNodeClassLoader
(NetChannelLocation sourceChannelLocation, ClassManager cm) Constructs a newNodeClassLoader
for loading classes held by a JFTP process at another node. -
Method Summary
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 Details
-
classReq
Channel for passing requests from thefindClass
method to the child process. -
classResp
Channel for returning data from the child process to thefindClass
method. -
classManager
The class manager responsible for managing dynamically loaded classes at this node.
-
-
Constructor Details
-
NodeClassLoader
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 Details
-
findClass
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 classClassLoader
- Parameters:
name
- name of the class to load.- Returns:
- the class instance.
- Throws:
ClassNotFoundException
- if the remote node did not have the class.
-