|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jboss.mx.loading.LoaderRepository
org.jboss.mx.loading.UnifiedLoaderRepository3
A repository of class loaders that form a flat namespace of classes and resources. This version uses UnifiedClassLoader3 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.
| Field Summary |
| Fields inherited from class org.jboss.mx.loading.LoaderRepository |
instance, loaders, translator |
| Constructor Summary | |
UnifiedLoaderRepository3()
|
|
| 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 |
Class |
getCachedClass(String classname)
|
int |
getCacheSize()
Get the number of classes loaded into the ULR cache. |
int |
getClassLoadersSize()
Get the number of UnifiedClassLoader3s (UCLs) in the ULR |
LoaderRepository |
getInstance()
|
MBeanNotificationInfo[] |
getNotificationInfo()
Returns the notification metadata associated with the MBean. |
Set |
getPackageClassLoaders(String className)
Called by LoadMgr to obtain all class loaders for the given className |
URL |
getResource(String name,
ClassLoader cl)
Loads a resource following the Unified ClassLoader architecture |
protected URL |
getResourceFromGlobalCache(String name)
Check for a resource in the global cache Synchronizes access to globalResources using the loaderToResourcesMap monitor |
protected URL |
getResourceFromRepository(String name,
ClassLoader cl)
|
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. |
RepositoryClassLoader |
getWrappingClassLoader(ClassLoader cl)
Get any wrapping classloader for the passed classloader |
Class |
loadClass(String className)
First tries to load from any UCL in the ULR, and if the class is not found, next tries the current thread context class loader. |
Class |
loadClass(String name,
boolean resolve,
ClassLoader cl)
Unlike other implementations of LoaderRepository, this method does nothing but ask the UnifiedClassLoader3 to load the class as UCL3s do not use this method. |
Class |
loadClassBefore(ClassLoader stop,
String className)
Loads a class from the repository, using the classloaders that were registered before the given classloader. |
Class |
loadClassFromCache(String name)
Lookup a Class from the repository cache. |
Class |
loadClassWithout(ClassLoader loader,
String className)
Loads a class from the repository, excluding the given classloader. |
RepositoryClassLoader |
newClassLoader(URL url,
boolean addToRepository)
Create RepositoryClassLoader and optionally add it to the repository |
RepositoryClassLoader |
newClassLoader(URL url,
URL origURL,
boolean addToRepository)
Create RepositoryClassLoader and optionally add it to the repository |
void |
postDeregister()
This method is called by the MBeanServer after deregistration takes place. |
void |
postRegister(Boolean registrationDone)
This method is called by the MBeanServer after registration takes place or when registration fails. |
void |
preDeregister()
This method is called by the MBeanServer before deregistration takes place. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
This method is called by the MBeanServer before registration takes place. |
LoaderRepository |
registerClassLoader(RepositoryClassLoader ucl)
This method provides an mbean-accessible way to add a UnifiedClassloader, and sends a notification when it is added. |
void |
removeClassLoader(ClassLoader loader)
Remove the class loader from the repository. |
void |
removeNotificationListener(NotificationListener listener)
removeNotificationListener delegates to our broadcaster object |
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Removes a listener from the Emitter. |
| Methods inherited from class org.jboss.mx.loading.LoaderRepository |
compare, getLoaders, getNativeClassForName, getTranslator, reverseCompare, 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 |
public UnifiedLoaderRepository3()
| Method Detail |
public RepositoryClassLoader newClassLoader(URL url, boolean addToRepository) throws Exception
LoaderRepository
newClassLoader in interface UnifiedLoaderRepositoryMBeannewClassLoader in class LoaderRepositoryurl - the URL to use for class loadingaddToRepository - a flag indicating if the CL should be added to
the repository
Exceptionpublic RepositoryClassLoader newClassLoader(URL url, URL origURL, boolean addToRepository) throws Exception
LoaderRepository
newClassLoader in interface UnifiedLoaderRepositoryMBeannewClassLoader in class LoaderRepositoryurl - the URL to use for class loadingorigURL - an orignal URL to use as the URL for the CL 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 CL should be added to
the repository
Exceptionpublic int getCacheSize()
UnifiedLoaderRepository3MBean
getCacheSize in interface UnifiedLoaderRepository3MBeanpublic int getClassLoadersSize()
UnifiedLoaderRepository3MBean
getClassLoadersSize in interface UnifiedLoaderRepository3MBeanpublic void flush()
UnifiedLoaderRepository3MBean
flush in interface UnifiedLoaderRepository3MBeanpublic Class getCachedClass(String classname)
getCachedClass in class LoaderRepositorypublic Class loadClass(String name, boolean resolve, ClassLoader cl) throws ClassNotFoundException
loadClass in class LoaderRepositoryname - resolve - cl -
ClassNotFoundExceptionpublic Set getPackageClassLoaders(String className)
getPackageClassLoaders in interface UnifiedLoaderRepository3MBeanpublic Class loadClassFromCache(String name)
name - the fully qualified class name
public void cacheLoadedClass(String name, Class cls, ClassLoader cl)
name - the fully qualified class namecls - the Class instancecl - the repository UCLpublic URL getResource(String name, ClassLoader cl)
getResource in class LoaderRepositoryname - the resource namecl - the requesting class loader
public void getResources(String name, ClassLoader cl, List urls)
getResources in class LoaderRepositoryname - the resource namecl - the requesting class loaderurls - a list into which the located resource URLs will be placedprotected URL getResourceFromGlobalCache(String name)
name -
protected URL getResourceFromRepository(String name, ClassLoader cl)
public URL[] getURLs()
getURLs in interface UnifiedLoaderRepositoryMBeangetURLs in class LoaderRepositorypublic String displayClassInfo(String className)
displayClassInfo in interface UnifiedLoaderRepository3MBeanpublic Class loadClass(String className) throws ClassNotFoundException
loadClass in interface ClassLoaderRepositoryloadClass in class LoaderRepositoryclassName - - the class to load
ClassNotFoundException - when there is no such classpublic Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException
loadClassWithout in interface ClassLoaderRepositoryloadClassWithout in class LoaderRepositoryloader - the classloader to excludeclassName - the class to load
ClassNotFoundException - when there is no such classpublic Class loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException
loadClassBefore in interface ClassLoaderRepositoryloadClassBefore in class LoaderRepositorystop - consult all the classloaders registered before this one
in an attempt to load a classclassName - name of the class to load
ClassNotFoundException - if none of the consulted classloaders were
able to load the requested classpublic RepositoryClassLoader getWrappingClassLoader(ClassLoader cl)
getWrappingClassLoader in interface UnifiedLoaderRepositoryMBeancl - the wrapped classloader
public void addClassLoader(ClassLoader loader)
addClassLoader in class LoaderRepositorypublic boolean addClassLoaderURL(ClassLoader cl, URL url)
LoaderRepository
addClassLoaderURL in class LoaderRepositorycl - url - public void removeClassLoader(ClassLoader loader)
removeClassLoader in interface UnifiedLoaderRepositoryMBeanremoveClassLoader in class LoaderRepositoryloader - public LoaderRepository registerClassLoader(RepositoryClassLoader ucl)
registerClassLoader in interface UnifiedLoaderRepositoryMBeanucl - an UnifiedClassLoader value
LoaderRepository valuepublic LoaderRepository getInstance()
getInstance in interface UnifiedLoaderRepositoryMBeanpublic void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException
addNotificationListener in interface NotificationBroadcasterlistener - a NotificationListener valuefilter - a NotificationFilter valuehandback - an Object value
IllegalArgumentException - if an error occurspublic MBeanNotificationInfo[] getNotificationInfo()
NotificationBroadcaster
getNotificationInfo in interface NotificationBroadcasterMBeanNotificationInfopublic void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
removeNotificationListener in interface NotificationBroadcasterlistener - a NotificationListener value
ListenerNotFoundException - if an error occurspublic void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
NotificationEmitterOnly the listener, filter, handback triplet is removed
removeNotificationListener in interface NotificationEmitterlistener - the listener object to removefilter - the filter registered with the listenerhandback - the handback object associated with the registered listener
ListenerNotFoundException - if the listener was not foundpublic ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
MBeanRegistrationThe MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preRegister in interface MBeanRegistrationException - for any error, the MBean is not registered.public void postRegister(Boolean registrationDone)
MBeanRegistration
postRegister in interface MBeanRegistrationregistrationDone - the MBeanServer passes true when the
MBean was registered, false otherwise.
public void preDeregister()
throws Exception
MBeanRegistrationThe MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
MBeanRegistration
postDeregister in interface MBeanRegistration
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||