This class manages a hash table of loaded generated classes and their GeneratedClass objects. A loaded class may be referenced multiple times -- each class has a reference count associated with it. When a load request arrives, if the class has already been loaded, its ref count is incremented. For a remove request, the ref count is decremented unless it is the last reference, in which case the class is removed. This is transparent to users.
org.apache.derby.iapi.services.loader.ClassFactory
| Modifier and Type | Field and Description |
|---|---|
| private UpdateLoader | |
| private ClassInspector |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | boot(boolean
True if the database should be created create, Properties Configuration properties startParams)Implements org. Boot this module with the given properties. |
| public ClassInspector | getClassInspector()
Implements org. Return a ClassInspector object |
| public int | getClassLoaderVersion()
Implements org. Return the in-memory "version" of the class manager. |
| private static ModuleFactory | |
| public boolean | isApplicationClass(Class<T>
The class in question theClass)Implements org. Was the passed in class loaded by a ClassManager. |
| public final Class | loadApplicationClass(String
The name of the class to load className)Implements org. Load an application class, or a class that is potentially an application class. |
| public final Class | loadApplicationClass(ObjectStreamClass
Descriptor for class classDescriptor)Implements org. Load an application class, or a class that is potentially an application class. |
| pack-priv abstract Class | |
| public final GeneratedClass | loadGeneratedClass(String
Full name of the class fullyQualifiedName, ByteArray The byte code of the class classDump)Implements org. Here we load the newly added class now, rather than waiting for the findGeneratedClass(). |
| pack-priv abstract LoadedGeneratedClass | |
| protected ClassInspector | |
| public void | notifyModifyClasspath(String
The classpath being modified classpath)Implements org. Notify the class manager that the classpath has been modified. |
| public void | notifyModifyJar(boolean
Restart any attached class loader reload)Implements org. Notify the class manager that a jar file has been modified. |
| public void | |
| private static void |
| applicationLoader | back to summary |
|---|---|
| private UpdateLoader applicationLoader | |
| classInspector | back to summary |
|---|---|
| private ClassInspector classInspector | |
| DatabaseClasses | back to summary |
|---|---|
| pack-priv DatabaseClasses() | |
| boot | back to summary |
|---|---|
| public void boot(boolean create, Properties startParams) throws StandardException Implements org. Doc from org. Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned. An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object
will be written to the service.properties of the persistent
service. Thus any code that requires an entry in service.properties
must explicitly place the value in this properties set
using the put method.
When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases. Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
| |
| getClassInspector | back to summary |
|---|---|
| public ClassInspector getClassInspector() Implements org. Doc from org. Return a ClassInspector object
| |
| getClassLoaderVersion | back to summary |
|---|---|
| public int getClassLoaderVersion() Implements org. Doc from org. Return the in-memory "version" of the class manager. The version is bumped everytime the classes are re-loaded.
| |
| getMonitor | back to summary |
|---|---|
| private static ModuleFactory getMonitor() Must be private so that user code can't call this entry point. | |
| isApplicationClass | back to summary |
|---|---|
| public boolean isApplicationClass(Class<T> theClass) Implements org. Doc from org. Was the passed in class loaded by a ClassManager.
| |
| loadApplicationClass | back to summary |
|---|---|
| public final Class Implements org. Doc from org. Load an application class, or a class that is potentially an application class.
| |
| loadApplicationClass | back to summary |
|---|---|
| public final Class Implements org. Doc from org. Load an application class, or a class that is potentially an application class.
| |
| loadClassNotInDatabaseJar | back to summary |
|---|---|
| pack-priv abstract Class | |
| loadGeneratedClass | back to summary |
|---|---|
| public final GeneratedClass loadGeneratedClass(String fullyQualifiedName, ByteArray classDump) throws StandardException Implements org. Here we load the newly added class now, rather than waiting for the findGeneratedClass(). Thus we are assuming that the class is going to be used sometime soon. Delaying the load would mean storing the class data in a file, this wastes cycles and compilcates the cleanup.
| |
| loadGeneratedClassFromData | back to summary |
|---|---|
| pack-priv abstract LoadedGeneratedClass loadGeneratedClassFromData(String fullyQualifiedName, ByteArray classDump) | |
| makeClassInspector | back to summary |
|---|---|
| protected ClassInspector makeClassInspector(DatabaseClasses dc) For creating the class inspector. | |
| notifyModifyClasspath | back to summary |
|---|---|
| public void notifyModifyClasspath(String classpath) throws StandardException Implements org. Notify the class manager that the classpath has been modified.
| |
| notifyModifyJar | back to summary |
|---|---|
| public void notifyModifyJar(boolean reload) throws StandardException Implements org. Doc from org. Notify the class manager that a jar file has been modified.
| |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Doc from org. Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well. | |
| WriteClassFile | back to summary |
|---|---|
| private static void WriteClassFile(String fullyQualifiedName, ByteArray bytecode, Throwable t) | |