|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.jboss.mx.loading.UnifiedClassLoader
A ClassLoader which loads classes from a single URL in conjunction with
the LoaderRepository
. Notice that this classloader does
not work independently of the repository. A repository reference
must be provided via the constructor or the classloader must be explicitly
registered to the repository before any attempt to load a class.
At this point this is little more than an abstract class maintained as the
interface for class loaders as the algorithm of the UnifiedLoaderRepository
fails with deadlocks, and several other class loading exceptions in multi-
threaded environments.
Field Summary | |
protected URL |
origURL
An optional URL from which url may have been copied. |
protected LoaderRepository |
repository
Reference to the unified repository. |
protected Exception |
unregisterTrace
The location where unregister is called from |
protected URL |
url
One URL per ClassLoader in our case |
Constructor Summary | |
UnifiedClassLoader(URL url)
Construct a UnifiedClassLoader without registering it to the classloader repository. |
|
UnifiedClassLoader(URL url,
LoaderRepository repository)
Construct a UnifiedClassLoader and registers it to the given repository. |
|
UnifiedClassLoader(URL url,
MBeanServer server,
ObjectName repositoryName)
UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName. |
|
UnifiedClassLoader(URL url,
URL origURL)
Construct a UnifiedClassLoader without registering it to the classloader repository. |
|
UnifiedClassLoader(URL url,
URL origURL,
ClassLoader parent)
Construct a UnifiedClassLoader without registering with the classloader repository. |
|
UnifiedClassLoader(URL url,
URL origURL,
LoaderRepository repository)
Construct a UnifiedClassLoader and registers it to the given repository. |
|
UnifiedClassLoader(URL url,
URL origURL,
MBeanServer server,
ObjectName repositoryName)
UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName. |
Method Summary | |
void |
addURL(URL url)
Append the given url to the URLs used for class and resource loading |
void |
clearBlacklists()
|
protected void |
definePackage(String className)
Define the package for the class if not already done |
boolean |
equals(Object other)
This is here to document that this must delegate to the super implementation to perform identity based equality. |
protected Class |
findClass(String name)
Called by loadClassLocally to find the requested class within this class loaders class path. |
Enumeration |
findResources(String name)
Find all resource URLs for the given name. |
Enumeration |
findResourcesLocally(String name)
Provides the same functionality as URLClassLoader.findResources(java.lang.String) . |
int |
getAddedOrder()
|
URL[] |
getAllURLs()
Return all library URLs associated with this UnifiedClassLoader |
URL[] |
getClasspath()
This method simply invokes the super.getURLs() method to access the list of URLs that make up the UnifiedClassLoader classpath. |
LoaderRepository |
getLoaderRepository()
|
ObjectName |
getObjectName()
Obtain the ObjectName under which the UCL can be registered with the JMX server. |
URL |
getOrigURL()
Get the original URL associated with the UCL. |
Package |
getPackage(String name)
|
Package[] |
getPackages()
|
protected PermissionCollection |
getPermissions(CodeSource cs)
Override the permissions accessor to use the CodeSource based on the original URL if one exists. |
protected ProtectionDomain |
getProtectionDomain()
Determine the protection domain. |
protected ProtectionDomain |
getProtectionDomain(URL codesourceUrl)
Determine the protection domain. |
URL |
getResource(String name)
Attempts to load the resource from its URL and if not found forwards to the request to LoaderRepository . |
URL |
getResourceLocally(String name)
Provides the same functionality as ClassLoader.getResource(java.lang.String) . |
URL |
getURL()
Get the URL associated with the UCL. |
URL[] |
getURLs()
Return an empty URL array to force the RMI marshalling subsystem to use the java.server.codebase property as the annotated codebase. |
int |
hashCode()
This is here to document that this must delegate to the super implementation to perform identity based hashing. |
protected byte[] |
loadByteCode(String classname)
Obtain the bytecode for the indicated class from this class loaders classpath. |
Class |
loadClass(String name,
boolean resolve)
The only caller of this method should be the VM initiated loadClassInternal() method. |
Class |
loadClassLocally(String name,
boolean resolve)
Called to attempt to load a class from the set of URLs associated with the UCL. |
void |
setAddedOrder(int addedOrder)
|
void |
setRepository(LoaderRepository repository)
|
String |
toString()
Retruns a string representaion of this UCL. |
void |
unregister()
|
Methods inherited from class java.net.URLClassLoader |
definePackage, findResource, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected LoaderRepository repository
protected Exception unregisterTrace
protected URL url
protected URL origURL
Constructor Detail |
public UnifiedClassLoader(URL url)
url
- the single URL to load classes from.public UnifiedClassLoader(URL url, URL origURL)
url
- the single URL to load classes from.origURL
- the possibly null original URL from which url may
be a local copy or nested jar.public UnifiedClassLoader(URL url, URL origURL, ClassLoader parent)
url
- the single URL to load classes from.origURL
- the possibly null original URL from which url may
be a local copy or nested jar.parent
- the parent class loader to usepublic UnifiedClassLoader(URL url, LoaderRepository repository)
url
- The single URL to load classes from.repository
- the repository this classloader delegates topublic UnifiedClassLoader(URL url, URL origURL, LoaderRepository repository)
url
- The single URL to load classes from.origURL
- the possibly null original URL from which url may
be a local copy or nested jar.repository
- the repository this classloader delegates to
be a local copy or nested jar.public UnifiedClassLoader(URL url, MBeanServer server, ObjectName repositoryName) throws Exception
url
- an URL
valueserver
- a MBeanServer
valuerepositoryName
- an ObjectName
value
Exception
- if an error occurspublic UnifiedClassLoader(URL url, URL origURL, MBeanServer server, ObjectName repositoryName) throws Exception
url
- an URL
valueorigURL
- the possibly null original URL from which url may
be a local copy or nested jar.server
- a MBeanServer
valuerepositoryName
- an ObjectName
value
Exception
- if an error occursMethod Detail |
public int getAddedOrder()
public void setAddedOrder(int addedOrder)
public ObjectName getObjectName() throws MalformedObjectNameException
MalformedObjectNameException
public void unregister()
public void addURL(URL url)
url
- the URL to load frompublic void clearBlacklists()
public LoaderRepository getLoaderRepository()
public void setRepository(LoaderRepository repository)
public Class loadClassLocally(String name, boolean resolve) throws ClassNotFoundException
ClassNotFoundException
public URL getResourceLocally(String name)
ClassLoader.getResource(java.lang.String)
.
getResourceLocally
in interface org.jboss.util.loading.Translatable
public URL getURL()
public URL getOrigURL()
public URL[] getClasspath()
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException
Forwards request to LoaderRepository
.
ClassNotFoundException
public URL getResource(String name)
LoaderRepository
.
public Enumeration findResources(String name) throws IOException
name
- the name of the resource
IOException
public Enumeration findResourcesLocally(String name) throws IOException
URLClassLoader.findResources(java.lang.String)
.
IOException
public final int hashCode()
public final boolean equals(Object other)
public URL[] getAllURLs()
Do not remove this method without running the WebIntegrationTestSuite
public URL[] getURLs()
Do not remove this method without discussing it on the dev list.
public Package getPackage(String name)
public Package[] getPackages()
public String toString()
protected Class findClass(String name) throws ClassNotFoundException
name
- the name of the class
ClassNotFoundException
- if the class could not be foundprotected void definePackage(String className)
className
- the class nameprotected PermissionCollection getPermissions(CodeSource cs)
cs
- the location and signatures of the codebase.protected ProtectionDomain getProtectionDomain()
protected ProtectionDomain getProtectionDomain(URL codesourceUrl)
protected byte[] loadByteCode(String classname) throws ClassNotFoundException, IOException
classname
-
ClassNotFoundException
- - if the class resource could not
be found
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |