/** * Return all library URLs associated with this RepositoryClassLoader * * <p>Do not remove this method without running the WebIntegrationTestSuite */ public URL[] getAllURLs() { return repository.getURLs(); }
/** * Subclasses can override if they wish to control the classloader * registration to loader repository. * * @param cl classloader */ protected void registerClassLoader(ClassLoader cl) { if( (cl instanceof RealClassLoader) == false ) { // Only register non-UCLs as UCLs already have a repository loaderRepository.addClassLoader(cl); } }
public Class<?> getCachedClass(String name) { LoaderRepository repository = this.repository; if (repository == null) return null; return repository.getCachedClass(name); }
public void unregister() { log.debug("Unregistering cl=" + this); if (repository != null) repository.removeClassLoader(this); clearBlacklists(); resourceCache.clear(); repository = null; this.unregisterTrace = new Exception(); }
/** * Load a class from the classloader that loaded this MBean */ private Class loadClass(String className) throws ClassNotFoundException { Class clazz = LoaderRepository.getNativeClassForName(className); if (clazz == null) { ClassLoader cl = getClass().getClassLoader(); clazz = cl.loadClass(className); } return clazz; }
/** * Compare two loader repository, by default we do no special ordering * * @param lr the loader repository * @return -1, 0, 1 depending upon the order */ public int compare(LoaderRepository lr) { if (lr == this) return 0; else return -lr.reverseCompare(this); }
/** * Attempts to load the resource from its URL and if not found * forwards to the request to {@link LoaderRepository}. */ public URL getResource(String name) { if (repository != null) return repository.getResource(name, this); return null; }
/** Find all resource URLs for the given name. This overrides the * URLClassLoader version to look for resources in the repository. * * @param name the name of the resource * @return Enumeration<URL> * @throws java.io.IOException */ public Enumeration findResources(String name) throws IOException { Vector resURLs = new Vector(); if( repository == null ) { String msg = "Invalid use of destroyed classloader, UCL destroyed at:"; IOException e = new IOException(msg); e.initCause(this.unregisterTrace); throw e; } repository.getResources(name, this, resURLs); return resURLs.elements(); }
throw new IllegalArgumentException("url cannot be null"); if( repository.addClassLoaderURL(this, url) == true )
throw e; Translator translator = repository.getTranslator(); if (translator != null)
public void unregister() { log.debug("Unregistering cl=" + this); if (repository != null) repository.removeClassLoader(this); clearBlacklists(); resourceCache.clear(); repository = null; this.unregisterTrace = new Exception(); }
for (int i = 0; i < signature.length; ++i) if (LoaderRepository.getNativeClassForName(signature[i]) == null) sign[i] = LoaderRepository.getNativeClassForName(signature[i]);
/** * Compare two loader repository, by default we do no special ordering * * @param lr the loader repository * @return -1, 0, 1 depending upon the order */ public int compare(LoaderRepository lr) { if (lr == this) return 0; else return -lr.reverseCompare(this); }
/** * Attempts to load the resource from its URL and if not found * forwards to the request to {@link LoaderRepository}. */ public URL getResource(String name) { if (repository != null) return repository.getResource(name, this); return null; }
/** Find all resource URLs for the given name. This overrides the * URLClassLoader version to look for resources in the repository. * * @param name the name of the resource * @return Enumeration<URL> * @throws java.io.IOException */ public Enumeration<URL> findResources(String name) throws IOException { Vector<URL> resURLs = new Vector<URL>(); if( repository == null ) { String msg = "Invalid use of destroyed classloader, UCL destroyed at:"; IOException e = new IOException(msg); e.initCause(this.unregisterTrace); throw e; } repository.getResources(name, this, resURLs); return resURLs.elements(); }
throw new IllegalArgumentException("url cannot be null"); if( repository.addClassLoaderURL(this, url) == true )
throw e; Translator translator = repository.getTranslator(); if (translator != null)
public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException { name = qualifyName(name); if (name.getDomain().equals(JMI_DOMAIN)) throw new RuntimeOperationsException(new IllegalArgumentException( "Not allowed to unregister: " + name.toString())); MBeanEntry entry = get(name); Object resource = entry.getResourceInstance(); try { // allow subclasses to perform their own pre- and post- pre-deregister logic handlePreDeregister (entry.getInvoker()); } catch (Exception e) { // don't double wrap MBeanRegistrationException if (e instanceof MBeanRegistrationException) throw (MBeanRegistrationException)e; throw new MBeanRegistrationException(e, "preDeregister"); } // Remove any classloader if (resource instanceof ClassLoader) loaderRepository.removeClassLoader((ClassLoader)resource); // It is no longer registered remove(name); sendUnRegistrationNotification (name); entry.getInvoker().postDeregister(); }
/** * Return all library URLs associated with this RepositoryClassLoader * * <p>Do not remove this method without running the WebIntegrationTestSuite */ public URL[] getAllURLs() { return repository.getURLs(); }
public Class<?> getCachedClass(String name) { LoaderRepository repository = this.repository; if (repository == null) return null; return repository.getCachedClass(name); }