|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 UnifiedLoaderRepositoryMBean
newClassLoader
in class LoaderRepository
url
- the URL to use for class loadingaddToRepository
- a flag indicating if the CL should be added to
the repository
Exception
public RepositoryClassLoader newClassLoader(URL url, URL origURL, boolean addToRepository) throws Exception
LoaderRepository
newClassLoader
in interface UnifiedLoaderRepositoryMBean
newClassLoader
in class LoaderRepository
url
- 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
Exception
public int getCacheSize()
UnifiedLoaderRepository3MBean
getCacheSize
in interface UnifiedLoaderRepository3MBean
public int getClassLoadersSize()
UnifiedLoaderRepository3MBean
getClassLoadersSize
in interface UnifiedLoaderRepository3MBean
public void flush()
UnifiedLoaderRepository3MBean
flush
in interface UnifiedLoaderRepository3MBean
public Class getCachedClass(String classname)
getCachedClass
in class LoaderRepository
public Class loadClass(String name, boolean resolve, ClassLoader cl) throws ClassNotFoundException
loadClass
in class LoaderRepository
name
- resolve
- cl
-
ClassNotFoundException
public Set getPackageClassLoaders(String className)
getPackageClassLoaders
in interface UnifiedLoaderRepository3MBean
public 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 LoaderRepository
name
- the resource namecl
- the requesting class loader
public void getResources(String name, ClassLoader cl, List urls)
getResources
in class LoaderRepository
name
- 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 UnifiedLoaderRepositoryMBean
getURLs
in class LoaderRepository
public String displayClassInfo(String className)
displayClassInfo
in interface UnifiedLoaderRepository3MBean
public Class loadClass(String className) throws ClassNotFoundException
loadClass
in interface ClassLoaderRepository
loadClass
in class LoaderRepository
className
- - the class to load
ClassNotFoundException
- when there is no such classpublic Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException
loadClassWithout
in interface ClassLoaderRepository
loadClassWithout
in class LoaderRepository
loader
- 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 ClassLoaderRepository
loadClassBefore
in class LoaderRepository
stop
- 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 UnifiedLoaderRepositoryMBean
cl
- the wrapped classloader
public void addClassLoader(ClassLoader loader)
addClassLoader
in class LoaderRepository
public boolean addClassLoaderURL(ClassLoader cl, URL url)
LoaderRepository
addClassLoaderURL
in class LoaderRepository
cl
- url
- public void removeClassLoader(ClassLoader loader)
removeClassLoader
in interface UnifiedLoaderRepositoryMBean
removeClassLoader
in class LoaderRepository
loader
- public LoaderRepository registerClassLoader(RepositoryClassLoader ucl)
registerClassLoader
in interface UnifiedLoaderRepositoryMBean
ucl
- 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 NotificationBroadcaster
listener
- a NotificationListener
valuefilter
- a NotificationFilter
valuehandback
- an Object
value
IllegalArgumentException
- if an error occurspublic MBeanNotificationInfo[] getNotificationInfo()
NotificationBroadcaster
getNotificationInfo
in interface NotificationBroadcaster
MBeanNotificationInfo
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
removeNotificationListener
in interface NotificationBroadcaster
listener
- a NotificationListener
value
ListenerNotFoundException
- if an error occurspublic void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
NotificationEmitter
Only the listener, filter, handback triplet is removed
removeNotificationListener
in interface NotificationEmitter
listener
- 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
MBeanRegistration
The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preRegister
in interface MBeanRegistration
Exception
- for any error, the MBean is not registered.public void postRegister(Boolean registrationDone)
MBeanRegistration
postRegister
in interface MBeanRegistration
registrationDone
- the MBeanServer passes true when the
MBean was registered, false otherwise.public void preDeregister() throws Exception
MBeanRegistration
The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |