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

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


org.jboss.mx.loading
Class UnifiedLoaderRepository4

java.lang.Object
  extended byorg.jboss.mx.loading.LoaderRepository
      extended byorg.jboss.mx.loading.UnifiedLoaderRepository4
All Implemented Interfaces:
ClassLoaderRepository, NotificationBroadcaster, ServerConstants, UnifiedLoaderRepository4MBean, UnifiedLoaderRepositoryMBean
Direct Known Subclasses:
HeirarchicalLoaderRepository4

public class UnifiedLoaderRepository4
extends LoaderRepository
implements NotificationBroadcaster, UnifiedLoaderRepository4MBean

A repository of class loaders that form a flat namespace of classes and resources. This version uses UnifiedClassLoader4 instances. Class and resource loading is synchronized by the acquiring the monitor to the associated repository structure monitor. See the variable javadoc comments for what monitor is used to access a given structure.

Version:
$Revision: 1.1.2.3 $ just a hint... xdoclet not really used
Author:
Scott Stark., Adrian Brock.

Field Summary
 
Fields inherited from class org.jboss.mx.loading.LoaderRepository
instance, loaders, nativeClassBySignature, translator
 
Fields inherited from interface org.jboss.mx.server.ServerConstants
CLASS_REMOVED, CLASSLOADER, CLASSLOADER_ADDED, CLASSLOADER_REMOVED, DEFAULT_DOMAIN, DEFAULT_LOADER_NAME, DEFAULT_LOADER_REPOSITORY_CLASS, DEFAULT_MBEAN_REGISTRY_CLASS, DEFAULT_MBEAN_SERVER_BUILDER_CLASS, DEFAULT_REQUIRED_MODELMBEAN_CLASS, DEFAULT_SCOPED_REPOSITORY_CLASS, DEFAULT_SCOPED_REPOSITORY_PARSER_CLASS, IMPLEMENTATION_NAME, IMPLEMENTATION_VENDOR, IMPLEMENTATION_VERSION, JMI_DOMAIN, LOADER_REPOSITORY_CLASS_PROPERTY, MBEAN_REGISTRY, MBEAN_REGISTRY_CLASS_PROPERTY, MBEAN_SERVER_BUILDER_CLASS_PROPERTY, MBEAN_SERVER_CONFIGURATION, MBEAN_SERVER_DELEGATE, OPTIMIZE_REFLECTED_DISPATCHER, REQUIRED_MODELMBEAN_CLASS_PROPERTY, SPECIFICATION_NAME, SPECIFICATION_VENDOR, SPECIFICATION_VERSION, UNIFIED_LOADER_REPOSITORY_CLASS
 
Constructor Summary
UnifiedLoaderRepository4()
           
 
Method Summary
 void addClassLoader(ClassLoader loader)
          Add a class loader to the repository.
 boolean addClassLoaderURL(ClassLoader cl, URL url)
          Update the set of URLs known to be associated with a previously added class loader.
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          addNotificationListener delegates to the broadcaster object we hold.
 void cacheLoadedClass(String name, Class cls, ClassLoader cl)
          Add a Class to the repository cache.
 String displayClassInfo(String className)
          A utility method that iterates over all repository class loaders and display the class information for every UCL that contains the given className
 void flush()
          Flush the ULR classes cache
 int getCacheSize()
          Get the number of classes loaded into the ULR cache.
 HashMap getClasses()
          The loaded classes cache, HashMap.
 int getClassIndexSize()
           
 UnifiedClassLoader4 getClassLoader(String className)
          Called by LoadMgr to the class loader for the given className
 HashSet getClassLoaders()
          HashSet of classloaders in the repository.
 LinkedList getClassLoaders(String className)
          Get the class loaders indexed to the given class name
 int getClassLoadersSize()
          Get the number of UnifiedClassLoader3s (UCLs) in the ULR
 HashMap getClassNamesMap()
           
 LoaderRepository getInstance()
           
 HashMap getLoaderToClassesMap()
           
 MBeanNotificationInfo[] getNotificationInfo()
          Returns the notification metadata associated with the MBean.
 URL getResource(String name, ClassLoader cl)
          Loads a resource following the Unified ClassLoader architecture
 void getResources(String name, ClassLoader cl, List urls)
          Find all resource URLs for the given name.
 URL[] getURLs()
          This is a utility method a listing of the URL for all UnifiedClassLoaders associated with the repository.
 Class loadClass(String className)
          Load the given class from the repository.
 Class loadClass(String name, boolean resolve, ClassLoader cl)
          Unlike other implementations of LoaderRepository, this method does nothing but ask the UnifiedClassLoader4 to load the class as UCL4 do not use this method.
 Class loadClassFromCache(String name)
          Lookup a Class from the repository cache.
 Class loadClassFromClassLoader(String name, boolean resolve, UnifiedClassLoader cl)
           
 Class loadClassWithout(ClassLoader loader, String className)
          Not used.
 UnifiedClassLoader newClassLoader(URL url, boolean addToRepository)
          Create UnifiedClassLoader and optionally add it to the repository
 UnifiedClassLoader newClassLoader(URL url, URL origURL, boolean addToRepository)
          Create UnifiedClassLoader and optionally add it to the repository
 LoaderRepository registerClassLoader(UnifiedClassLoader ucl)
          This method provides an mbean-accessible way to add a UnifiedClassloader, and sends a notification when it is added.
 void removeClassLoader(ClassLoader cl)
          Remove the class loader from the repository.
 void removeNotificationListener(NotificationListener listener)
          removeNotificationListener delegates to our broadcaster object
 
Methods inherited from class org.jboss.mx.loading.LoaderRepository
getCachedClass, getDefaultLoaderRepository, getLoaders, getNativeClassForName, getTranslator, loadClassBefore, setTranslator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.mx.loading.UnifiedLoaderRepositoryMBean
getTranslator, setTranslator
 

Constructor Detail

UnifiedLoaderRepository4

public UnifiedLoaderRepository4()
Method Detail

newClassLoader

public UnifiedClassLoader newClassLoader(URL url,
                                         boolean addToRepository)
                                  throws Exception
Description copied from class: LoaderRepository
Create UnifiedClassLoader and optionally add it to the repository

Specified by:
newClassLoader in interface UnifiedLoaderRepositoryMBean
Specified by:
newClassLoader in class LoaderRepository
Parameters:
url - the URL to use for class loading
addToRepository - a flag indicating if the UCL should be added to the repository
Returns:
the UCL instance
Throws:
Exception

newClassLoader

public UnifiedClassLoader newClassLoader(URL url,
                                         URL origURL,
                                         boolean addToRepository)
                                  throws Exception
Description copied from class: LoaderRepository
Create UnifiedClassLoader and optionally add it to the repository

Specified by:
newClassLoader in interface UnifiedLoaderRepositoryMBean
Specified by:
newClassLoader in class LoaderRepository
Parameters:
url - the URL to use for class loading
origURL - an orignal URL to use as the URL for the UCL CodeSource. This is useful when the url is a local copy that is difficult to use for security policy writing.
addToRepository - a flag indicating if the UCL should be added to the repository
Returns:
the UCL instance
Throws:
Exception

getClassLoaders

public HashSet getClassLoaders()
HashSet of classloaders in the repository. Access synchronized via this.classLoaders monitor.


getClasses

public HashMap getClasses()
The loaded classes cache, HashMap. Access synchronized via this.classes monitor.


getClassNamesMap

public HashMap getClassNamesMap()

getLoaderToClassesMap

public HashMap getLoaderToClassesMap()

getCacheSize

public int getCacheSize()
Description copied from interface: UnifiedLoaderRepository4MBean
Get the number of classes loaded into the ULR cache.

Specified by:
getCacheSize in interface UnifiedLoaderRepository4MBean
Returns:
the classes cache size.

getClassLoadersSize

public int getClassLoadersSize()
Description copied from interface: UnifiedLoaderRepository4MBean
Get the number of UnifiedClassLoader3s (UCLs) in the ULR

Specified by:
getClassLoadersSize in interface UnifiedLoaderRepository4MBean
Returns:
the number of UCLs in the ULR

getClassIndexSize

public int getClassIndexSize()

flush

public void flush()
Description copied from interface: UnifiedLoaderRepository4MBean
Flush the ULR classes cache

Specified by:
flush in interface UnifiedLoaderRepository4MBean

loadClass

public Class loadClass(String name,
                       boolean resolve,
                       ClassLoader cl)
                throws ClassNotFoundException
Unlike other implementations of LoaderRepository, this method does nothing but ask the UnifiedClassLoader4 to load the class as UCL4 do not use this method.

Specified by:
loadClass in class LoaderRepository
Parameters:
name -
resolve -
cl -
Returns:
Throws:
ClassNotFoundException

getClassLoaders

public LinkedList getClassLoaders(String className)
Get the class loaders indexed to the given class name

Specified by:
getClassLoaders in interface UnifiedLoaderRepository4MBean
Returns:
HashSet, may be null

getClassLoader

public UnifiedClassLoader4 getClassLoader(String className)
Description copied from interface: UnifiedLoaderRepository4MBean
Called by LoadMgr to the class loader for the given className

Specified by:
getClassLoader in interface UnifiedLoaderRepository4MBean
Returns:
UnifiedClassLoader3, may be null

loadClassFromCache

public Class loadClassFromCache(String name)
Lookup a Class from the repository cache.

Parameters:
name - the fully qualified class name
Returns:
the cached Class if found, null otherwise

cacheLoadedClass

public void cacheLoadedClass(String name,
                             Class cls,
                             ClassLoader cl)
Add a Class to the repository cache.

Parameters:
name - the fully qualified class name
cls - the Class instance
cl - the repository UCL

loadClassFromClassLoader

public Class loadClassFromClassLoader(String name,
                                      boolean resolve,
                                      UnifiedClassLoader cl)

getResource

public URL getResource(String name,
                       ClassLoader cl)
Loads a resource following the Unified ClassLoader architecture

Specified by:
getResource in class LoaderRepository
Parameters:
name - the resource name
cl - the requesting class loader
Returns:
The resource URL if found, null otherwise

getResources

public void getResources(String name,
                         ClassLoader cl,
                         List urls)
Find all resource URLs for the given name. This is entails an exhuastive search of the repository and is an expensive operation.

Specified by:
getResources in class LoaderRepository
Parameters:
name - the resource name
cl - the requesting class loader
urls - a list into which the located resource URLs will be placed

getURLs

public URL[] getURLs()
This is a utility method a listing of the URL for all UnifiedClassLoaders associated with the repository. It is never called in response to class or resource loading.

Specified by:
getURLs in interface UnifiedLoaderRepositoryMBean
Overrides:
getURLs in class LoaderRepository
Returns:
URL[] for the repository classpath

displayClassInfo

public String displayClassInfo(String className)
A utility method that iterates over all repository class loaders and display the class information for every UCL that contains the given className

Specified by:
displayClassInfo in interface UnifiedLoaderRepository4MBean

loadClass

public Class loadClass(String className)
                throws ClassNotFoundException
Description copied from class: LoaderRepository
Load the given class from the repository.

Specified by:
loadClass in interface ClassLoaderRepository
Specified by:
loadClass in class LoaderRepository
Parameters:
className -
Returns:
Throws:
ClassNotFoundException

loadClassWithout

public Class loadClassWithout(ClassLoader loader,
                              String className)
                       throws ClassNotFoundException
Description copied from class: LoaderRepository
Not used.

Specified by:
loadClassWithout in interface ClassLoaderRepository
Specified by:
loadClassWithout in class LoaderRepository
Parameters:
loader -
className -
Returns:
Throws:
ClassNotFoundException

addClassLoader

public void addClassLoader(ClassLoader loader)
Add a class loader to the repository.

Specified by:
addClassLoader in class LoaderRepository

addClassLoaderURL

public boolean addClassLoaderURL(ClassLoader cl,
                                 URL url)
Description copied from class: LoaderRepository
Update the set of URLs known to be associated with a previously added class loader.

Specified by:
addClassLoaderURL in class LoaderRepository
Parameters:
cl -
url -

removeClassLoader

public void removeClassLoader(ClassLoader cl)
Remove the class loader from the repository. This synchronizes on the this.classLoaders

Specified by:
removeClassLoader in interface UnifiedLoaderRepositoryMBean
Specified by:
removeClassLoader in class LoaderRepository
Parameters:
cl -

registerClassLoader

public LoaderRepository registerClassLoader(UnifiedClassLoader ucl)
This method provides an mbean-accessible way to add a UnifiedClassloader, and sends a notification when it is added.

Specified by:
registerClassLoader in interface UnifiedLoaderRepositoryMBean
Parameters:
ucl - an UnifiedClassLoader value
Returns:
a LoaderRepository value

getInstance

public LoaderRepository getInstance()
Specified by:
getInstance in interface UnifiedLoaderRepositoryMBean

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
                             throws IllegalArgumentException
addNotificationListener delegates to the broadcaster object we hold.

Specified by:
addNotificationListener in interface NotificationBroadcaster
Parameters:
listener - a NotificationListener value
filter - a NotificationFilter value
handback - an Object value
Throws:
IllegalArgumentException - if an error occurs

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Description copied from interface: NotificationBroadcaster
Returns the notification metadata associated with the MBean.

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Returns:
See Also:
MBeanNotificationInfo

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
removeNotificationListener delegates to our broadcaster object

Specified by:
removeNotificationListener in interface NotificationBroadcaster
Parameters:
listener - a NotificationListener value
Throws:
ListenerNotFoundException - if an error occurs


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