public class OpenmrsClassLoader extends URLClassLoader
| Constructor and Description |
|---|
OpenmrsClassLoader()
Normal constructor.
|
OpenmrsClassLoader(ClassLoader parent)
Creates the instance for the OpenmrsClassLoader
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
clearReferences()
This clears any references this classloader might have that will prevent garbage collection.
|
static void |
destroyInstance()
Destroy the current instance of the classloader.
|
static URL |
expandURL(URL result,
File folder)
Expand the given URL into the given folder
|
URL |
findResource(String name) |
Enumeration<URL> |
findResources(String name) |
static void |
flushInstance()
All objects depending on the old classloader should be restarted here Should be called after
destoryInstance() and after the service is restarted
|
static OpenmrsClassLoader |
getInstance()
Get the static/singular instance of the module class loader
|
static File |
getLibCacheFolder()
Get the temporary "work" directory for expanded jar files
|
InputStream |
getResourceAsStream(String file)
Searches all known module classloaders first, then parent classloaders
|
Enumeration<URL> |
getResources(String packageName)
Searches all known module classloaders first, then parent classloaders
|
Class<?> |
loadClass(String name,
boolean resolve)
It attempts to load classes from the module class loaders first and then
tries the web container class loader (parent class loader).
|
protected static boolean |
loadedByThisOrChild(Class<?> clazz)
Determine whether a class was loaded by this class loader or one of its child class loaders.
|
protected static void |
nullInstance(Object instance)
Used by
clearReferences() upon application close. |
static void |
onShutdown() |
static void |
restoreState()
This method should be called after restoring the instance
|
static void |
saveState()
This method should be called before destroying the instance
|
static void |
setThreadsToNewClassLoader()
Sets the class loader, for all threads referencing a destroyed openmrs class loader,
to the current one.
|
String |
toString() |
addURL, close, definePackage, findClass, getPermissions, getURLs, newInstance, newInstancedefineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic OpenmrsClassLoader(ClassLoader parent)
public OpenmrsClassLoader()
public static OpenmrsClassLoader getInstance()
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
public URL findResource(String name)
findResource in class URLClassLoaderURLClassLoader.findResource(java.lang.String)public Enumeration<URL> findResources(String name) throws IOException
findResources in class URLClassLoaderIOExceptionURLClassLoader.findResources(java.lang.String)public InputStream getResourceAsStream(String file)
getResourceAsStream in class URLClassLoaderClassLoader.getResourceAsStream(java.lang.String)public Enumeration<URL> getResources(String packageName) throws IOException
getResources in class ClassLoaderIOExceptionClassLoader.getResources(java.lang.String)public String toString()
toString in class ObjectObject.toString()public static void destroyInstance()
flushInstance()public static void setThreadsToNewClassLoader()
public static void onShutdown()
protected static void clearReferences()
protected static void nullInstance(Object instance)
instance - the object whose fields need to be nulled outprotected static boolean loadedByThisOrChild(Class<?> clazz)
public static void saveState()
destroyInstance()public static void restoreState()
destroyInstance(),
saveState()public static void flushInstance()
destroyInstance()public static File getLibCacheFolder()
Copyright © 2024 OpenMRS Inc.. All rights reserved.