mucode
Class MuClassLoader

java.lang.Object
java.lang.ClassLoader
mucode.MuClassLoader
- All Implemented Interfaces:
- MuConstants
- public class MuClassLoader
- extends java.lang.ClassLoader
- implements MuConstants
Redefines class loading according to the policy of µCode.
When a class name C needs to be resolved during the execution of a
thread t, the class loader that gets invoked is the one that was
used to load t's class, according to the rules stated by the Java
specification. If the t has been created with a class that comes
from a group, the class loader will be an instance of
MuClassLoader. Otherwise, it will be the system class
loader.
The class loading policy implemented by MuClassLoader is as
follows. Assuming t is executing within a µServer
S, the class loader will perform the following steps:
- Check whether C is a ubiquitous class, i.e. a class
available on every µServer. The set of ubiquitous classes can
be changed dynamically using the methods in MuServer. Classes
belonging to the Java API (
java.*, javax.*, and
sub-packages) and to µCode (mucode.* and
sub-packages) are ubiquitous by default. Checking ubiquitous classes first
prevents redefinition of their behavior.
- Search for C in the private class space associated with
t in S. Threads created directly by applications and not as a
consequence of migration are all associated with the same class space,
managed by the system Java class loader.
- Search for C in the shared class space associated with
S.
- If t is allowed to perform dynamic download, C is
retrieved from the remote µServer specified by the user at
migration time (that can be retrieved using
Group.getDynamicLinkSource() 55 , and loaded.
- If C cannot be found, throw a
java.lang.ClassNotFoundException.
Note how classes belonging to the file system are never searched. Those are
accessible only to threads that have been created directly by applications,
because in that case loading is performed by the system class loader.
- Version:
- 1.0
| Nested classes inherited from class java.lang.ClassLoader |
|
| Fields inherited from interface mucode.MuConstants |
COMPRESSIONkey, DEBUGkey, DYN_LINK, ERRORSkey, GROUP, MESSAGESkey, OK, PACKAGE_NAME, PORTkey, REMOTE_ERROR, SERVER_PORT, TIMEOUT, TIMEOUTkey, UBICLASSESkey, UBIPACKAGESkey, UNKNOWN |
| Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classSpace
protected ClassSpace classSpace
- The private class space.
server
protected MuServer server
dynLinkSource
protected java.lang.String dynLinkSource
MuClassLoader
protected MuClassLoader(MuServer aServer)
getServer
MuServer getServer()
getClassSpace
public ClassSpace getClassSpace()
getCurrent
public static MuClassLoader getCurrent()
- Return the class loader associated to the current thread, i.e., the one
that has been used to load the thread's class. If it is the system class
loader, a wrapper to such loader is returned.
getClassLoader
public static MuClassLoader getClassLoader(java.lang.Class c)
- Return the class loader associated with the given class, i.e., the one
that has been used to load it the first time. If the class has been
loaded by the system class loader, a wrapper to such loader is returned.
loadClass
public java.lang.Class loadClass(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
- Redefines the behavior of the class loader.