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 |
deleteOldLibCaches(File libCacheFolder)
Deletes the old lib cache folders that might not have been deleted when OpenMRS closed
|
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) |
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
|
String |
toString() |
addURL, close, definePackage, findClass, getPermissions, getURLs, newInstance, newInstance
defineClass, defineClass
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public OpenmrsClassLoader(ClassLoader parent)
public OpenmrsClassLoader()
public static OpenmrsClassLoader getInstance()
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
ClassLoader.loadClass(java.lang.String, boolean)
public URL findResource(String name)
findResource
in class URLClassLoader
URLClassLoader.findResource(java.lang.String)
public Enumeration<URL> findResources(String name) throws IOException
findResources
in class URLClassLoader
IOException
URLClassLoader.findResources(java.lang.String)
public InputStream getResourceAsStream(String file)
getResourceAsStream
in class URLClassLoader
ClassLoader.getResourceAsStream(java.lang.String)
public Enumeration<URL> getResources(String packageName) throws IOException
getResources
in class ClassLoader
IOException
ClassLoader.getResources(java.lang.String)
public String toString()
toString
in class Object
Object.toString()
public static void destroyInstance()
flushInstance()
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()
public static void deleteOldLibCaches(File libCacheFolder)
libCacheFolder
- Copyright © 2018 OpenMRS LLC.. All Rights Reserved.