站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jmx API Documentation 英文版文档

UnifiedClassLoader2 (JBoss/JMX API) - JBoss 3.2.7 jmx API Documentation 英文版文档


org.jboss.mx.loading
Class UnifiedClassLoader2

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.jboss.mx.loading.UnifiedClassLoader
                  extended byorg.jboss.mx.loading.UnifiedClassLoader2
All Implemented Interfaces:
org.jboss.util.loading.Translatable, UnifiedClassLoader2MBean, UnifiedClassLoaderMBean

public class UnifiedClassLoader2
extends UnifiedClassLoader
implements UnifiedClassLoader2MBean

An extension of UnifiedClassLoader that only allows a single thread into its UnifiedLoaderRepository2 by seperating the threads attempting class loading through it and the single thread active in the UnifiedLoaderRepository2 by registering a delegate UnifiedClassLoader with the UnifiedLoaderRepository2 rather than itself. Thus it does not matter how locked up this instance may be by the VM since the calling thread has to acquire a singleton lock to get into the UnifiedLoaderRepository2, and once in, that thread can never interact with any UnifiedClassLoader2, including the instance originating the class loading since only the delegate UnifiedClassLoader instances are registered with the repository.

Version:
$Revision: 1.3.4.3 $
Author:
Scott Stark

Field Summary
 
Fields inherited from class org.jboss.mx.loading.UnifiedClassLoader
origURL, repository, unregisterTrace, url
 
Constructor Summary
UnifiedClassLoader2(URL url)
          Construct a UnifiedClassLoader without registering it to the classloader repository.
UnifiedClassLoader2(URL url, URL origURL)
          Construct a UnifiedClassLoader without registering it to the classloader repository.
UnifiedClassLoader2(URL url, URL origURL, LoaderRepository repository)
          Construct a UnifiedClassLoader and registers it to the given repository.
 
Method Summary
 URL[] getClasspath()
          This method simply invokes the super.getURLs() method to access the list of URLs that make up the UnifiedClassLoader classpath.
 UnifiedClassLoader getDelegate()
           
 URL getOrigURL()
          Get the original URL associated with the UCL.
 URL getResource(String name)
          Attempts to load the resource from its URL and if not found forwards to the request to LoaderRepository.
 URL getURL()
          Get the URL associated with the UCL.
 Class loadClass(String name, boolean resolve)
          We intercept the load class to know exactly the dependencies of the underlying jar.
 void unregister()
           
 
Methods inherited from class org.jboss.mx.loading.UnifiedClassLoader
addURL, clearBlacklists, definePackage, equals, findClass, findResources, findResourcesLocally, getAddedOrder, getAllURLs, getLoaderRepository, getObjectName, getPackage, getPackages, getPermissions, getProtectionDomain, getProtectionDomain, getResourceLocally, getURLs, hashCode, loadByteCode, loadClassLocally, setAddedOrder, setRepository, toString
 
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.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnifiedClassLoader2

public UnifiedClassLoader2(URL url)
Construct a UnifiedClassLoader without registering it to the classloader repository.

Parameters:
url - the single URL to load classes from.

UnifiedClassLoader2

public UnifiedClassLoader2(URL url,
                           URL origURL)
Construct a UnifiedClassLoader without registering it to the classloader repository.

Parameters:
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.

UnifiedClassLoader2

public UnifiedClassLoader2(URL url,
                           URL origURL,
                           LoaderRepository repository)
Construct a UnifiedClassLoader and registers it to the given repository.

Parameters:
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.
Method Detail

unregister

public void unregister()
Overrides:
unregister in class UnifiedClassLoader

getDelegate

public UnifiedClassLoader getDelegate()

getURL

public URL getURL()
Get the URL associated with the UCL.

Overrides:
getURL in class UnifiedClassLoader

getOrigURL

public URL getOrigURL()
Get the original URL associated with the UCL. This may be null.

Overrides:
getOrigURL in class UnifiedClassLoader

getClasspath

public URL[] getClasspath()
This method simply invokes the super.getURLs() method to access the list of URLs that make up the UnifiedClassLoader classpath.

Overrides:
getClasspath in class UnifiedClassLoader

loadClass

public Class loadClass(String name,
                       boolean resolve)
                throws ClassNotFoundException
We intercept the load class to know exactly the dependencies of the underlying jar.

Forwards request to LoaderRepository.

Overrides:
loadClass in class UnifiedClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)
Attempts to load the resource from its URL and if not found forwards to the request to LoaderRepository.

Overrides:
getResource in class UnifiedClassLoader


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.