|
|||||||||||
| 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 | |
protected HashMap |
loaderToResourcesMap
HashMap |
| Fields inherited from class org.jboss.mx.loading.LoaderRepository |
instance, loaders, nativeClassBySignature, 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. |
HashSet |
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. |
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 |
loadClassFromCache(String name)
Lookup a Class from the repository cache. |
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 |
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(UnifiedClassLoader 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 |
| Methods inherited from class org.jboss.mx.loading.LoaderRepository |
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 |
| Field Detail |
protected HashMap loaderToResourcesMap
| Constructor Detail |
public UnifiedLoaderRepository3()
| Method Detail |
public UnifiedClassLoader 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 UCL should be added to
the repository
Exception
public UnifiedClassLoader 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 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
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 LoaderRepository
public Class loadClass(String name,
boolean resolve,
ClassLoader cl)
throws ClassNotFoundException
loadClass in class LoaderRepositoryname - resolve - cl -
ClassNotFoundExceptionpublic HashSet 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 UCL
public 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 UnifiedLoaderRepository3MBean
public Class loadClass(String className)
throws ClassNotFoundException
loadClass in interface ClassLoaderRepositoryloadClass in class LoaderRepositoryclassName - - the class to load
ClassNotFoundException
public Class loadClassWithout(ClassLoader loader,
String className)
throws ClassNotFoundException
LoaderRepository
loadClassWithout in interface ClassLoaderRepositoryloadClassWithout in class LoaderRepositoryloader - className -
ClassNotFoundExceptionpublic void addClassLoader(ClassLoader loader)
addClassLoader in class LoaderRepository
public 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(UnifiedClassLoader ucl)
registerClassLoader in interface UnifiedLoaderRepositoryMBeanucl - an UnifiedClassLoader value
LoaderRepository valuepublic LoaderRepository getInstance()
getInstance in interface UnifiedLoaderRepositoryMBean
public 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 NotificationBroadcasterMBeanNotificationInfo
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException
removeNotificationListener in interface NotificationBroadcasterlistener - a NotificationListener value
ListenerNotFoundException - if an error occurs
public 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 | ||||||||||