public class NonLockingUrlClassLoader
extends java.net.URLClassLoader
Modifier and Type | Field and Description |
---|---|
protected boolean |
cacheJars |
protected java.io.File |
jarDir |
protected org.apache.log4j.Logger |
log |
protected java.lang.String |
name |
Constructor and Description |
---|
NonLockingUrlClassLoader(java.lang.ClassLoader parent,
java.io.File jarDir,
java.lang.String name) |
NonLockingUrlClassLoader(java.lang.ClassLoader parent,
java.io.File jarDir,
java.lang.String name,
boolean cacheJars)
Use this constructor and set cacheJars to true to be able to cache jars over Gateway restarts.
|
Modifier and Type | Method and Description |
---|---|
void |
addCachedJarFile(java.io.File cachedJar)
Adds a previously cached jar file to the classloader
|
void |
addJarFile(java.io.File f) |
java.io.File |
addJarFile(java.lang.String filename,
java.io.InputStream is) |
void |
addSourceDirectory(java.io.File dir) |
void |
addSourceDirectory(java.io.File dir,
java.io.FileFilter filter) |
protected void |
addURL(java.net.URL url) |
protected void |
finalize() |
java.io.File |
getJarDir() |
static void |
main(java.lang.String[] args) |
close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
protected org.apache.log4j.Logger log
protected java.io.File jarDir
protected java.lang.String name
protected boolean cacheJars
public NonLockingUrlClassLoader(java.lang.ClassLoader parent, java.io.File jarDir, java.lang.String name)
public NonLockingUrlClassLoader(java.lang.ClassLoader parent, java.io.File jarDir, java.lang.String name, boolean cacheJars)
parent
- the parent classloader for delegationjarDir
- the directory in which the jars are placed and/or cachedname
- a name used to identify this classloadercacheJars
- whether or not to cache the jars across gateway reloadspublic java.io.File getJarDir()
public void addSourceDirectory(java.io.File dir) throws java.io.IOException
java.io.IOException
public void addSourceDirectory(java.io.File dir, java.io.FileFilter filter) throws java.io.IOException
java.io.IOException
public void addJarFile(java.io.File f) throws java.io.IOException
java.io.IOException
public void addCachedJarFile(java.io.File cachedJar) throws java.net.MalformedURLException
cachedJar
- the jar to add to the classloaderjava.net.MalformedURLException
- if the jar file's URI cannot be converted to a URLpublic java.io.File addJarFile(java.lang.String filename, java.io.InputStream is) throws java.io.IOException
java.io.IOException
protected void addURL(java.net.URL url)
addURL
in class java.net.URLClassLoader
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public static void main(java.lang.String[] args)