|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader java.security.SecureClassLoader java.net.URLClassLoader org.openmrs.util.OpenmrsClassLoader
public class OpenmrsClassLoader
This classloader knows about the current ModuleClassLoaders and will attempt to load classes from them if needed
Constructor Summary | |
---|---|
OpenmrsClassLoader()
Normal constructor. |
|
OpenmrsClassLoader(java.lang.ClassLoader parent)
Creates the instance for the OpenmrsClassLoader |
Method Summary | |
---|---|
protected static void |
clearReferences()
This clears any references this classloader might have that will prevent garbage collection. |
static void |
deleteOldLibCaches(java.io.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 java.net.URL |
expandURL(java.net.URL result,
java.io.File folder)
Expand the given URL into the given folder |
java.net.URL |
findResource(java.lang.String name)
|
java.util.Enumeration<java.net.URL> |
findResources(java.lang.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 java.io.File |
getLibCacheFolder()
Get the temporary "work" directory for expanded jar files |
java.io.InputStream |
getResourceAsStream(java.lang.String file)
Searches all known module classloaders first, then parent classloaders |
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String packageName)
Searches all known module classloaders first, then parent classloaders |
java.lang.Class<?> |
loadClass(java.lang.String name,
boolean resolve)
|
protected static boolean |
loadedByThisOrChild(java.lang.Class<?> clazz)
Determine whether a class was loaded by this class loader or one of its child class loaders. |
protected static void |
nullInstance(java.lang.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 |
java.lang.String |
toString()
|
Methods inherited from class java.net.URLClassLoader |
---|
addURL, definePackage, findClass, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OpenmrsClassLoader(java.lang.ClassLoader parent)
public OpenmrsClassLoader()
Method Detail |
---|
public static OpenmrsClassLoader getInstance()
public java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
ClassLoader.loadClass(java.lang.String, boolean)
public java.net.URL findResource(java.lang.String name)
findResource
in class java.net.URLClassLoader
URLClassLoader.findResource(java.lang.String)
public java.util.Enumeration<java.net.URL> findResources(java.lang.String name) throws java.io.IOException
findResources
in class java.net.URLClassLoader
java.io.IOException
URLClassLoader.findResources(java.lang.String)
public java.io.InputStream getResourceAsStream(java.lang.String file)
getResourceAsStream
in class java.lang.ClassLoader
ClassLoader.getResourceAsStream(java.lang.String)
public java.util.Enumeration<java.net.URL> getResources(java.lang.String packageName) throws java.io.IOException
getResources
in class java.lang.ClassLoader
java.io.IOException
ClassLoader.getResources(java.lang.String)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public static void destroyInstance()
flushInstance()
public static void onShutdown()
protected static void clearReferences()
protected static void nullInstance(java.lang.Object instance)
clearReferences()
upon application close.
instance
- the object whose fields need to be nulled outprotected static boolean loadedByThisOrChild(java.lang.Class<?> clazz)
public static void saveState()
destroyInstance()
public static void restoreState()
destroyInstance()
,
saveState()
public static void flushInstance()
destroyInstance()
public static java.io.File getLibCacheFolder()
public static void deleteOldLibCaches(java.io.File libCacheFolder)
libCacheFolder
- public static java.net.URL expandURL(java.net.URL result, java.io.File folder)
result
- URL of the file to expandfolder
- File (directory) to place the expanded file
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |