/** * Register the classloader with the mbeanserver * * @param classLoader the classloader * @throws Exception for any error */ protected void registerClassLoaderWithMBeanServer(ClassLoader classLoader) throws Exception { if (mbeanServer == null) return; if (classLoader instanceof RealClassLoader == false) return; RealClassLoader jmxClassLoader = (RealClassLoader) classLoader; ObjectName name = jmxClassLoader.getObjectName(); if (mbeanServer.isRegistered(name)) return; mbeanServer.registerMBean(classLoader, name); }
public URL getResource(String name) { // See if it is cached at a global level URL resource = parent.getCachedResource(name); // Not cached if (resource == null) { // Standard loading looks at the bootstrap classloader if (standard) resource = super.getResource(name); // We should really let the parent decide to do that else resource = getParent().getResource(name); } return resource; } }
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First see if we already know it Class<?> clazz = findLoadedClass(name); // Next see if it is cached at a more global level if (clazz == null) clazz = parent.getCachedClass(name); // Not cached if (clazz == null) { // Standard loading looks at the bootstrap classloader if (standard) clazz = super.loadClass(name, resolve); // We should really let the parent decide to do that else clazz = getParent().loadClass(name); } // Do we need to resolve the class? if (resolve) resolveClass(clazz); return clazz; }
/** * Check to see if the class is already loaded * * @param name the name of the class * @param trace whether trace is enabled * @return the class is if it is already loaded, null otherwise */ protected Class<?> isLoadedClass(String name, boolean trace) { Class<?> result = findLoadedClass(name); if (result != null) { // Has this classloader been undeployed? ClassLoader otherClassLoader = getClassLoader(result); if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader) { RealClassLoader rcl = (RealClassLoader) otherClassLoader; // Ignore when undeployed if (rcl.isValid() == false) { if (trace) log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result)); result = null; } } } if (result != null && trace) log.trace(this + " already loaded class " + ClassLoaderUtils.classToString(result)); return result; }
((RealClassLoader)myloader).clearBlackList(classFileName);
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First see if we already know it Class<?> clazz = findLoadedClass(name); // Next see if it is cached at a more global level if (clazz == null) clazz = parent.getCachedClass(name); // Not cached if (clazz == null) { // Standard loading looks at the bootstrap classloader if (standard) clazz = super.loadClass(name, resolve); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) clazz = getParent().loadClass(name); else { clazz = SecurityActions.getParentClassLoader(this).loadClass(name); } } } // Do we need to resolve the class? if (resolve) resolveClass(clazz); return clazz; }
/** * Check to see if the class is already loaded * * @param name the name of the class * @param trace whether trace is enabled * @return the class is if it is already loaded, null otherwise */ protected Class<?> isLoadedClass(String name, boolean trace) { Class<?> result = findLoadedClass(name); if (result != null) { // Has this classloader been undeployed? ClassLoader otherClassLoader = getClassLoader(result); if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader) { RealClassLoader rcl = (RealClassLoader) otherClassLoader; // Ignore when undeployed if (rcl.isValid() == false) { if (trace) log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result)); result = null; } } } if (result != null && trace) log.trace(this + " already loaded class " + ClassLoaderUtils.classToString(result)); return result; }
/** * Register the classloader with the mbeanserver * * @param classLoader the classloader * @throws Exception for any error */ protected void registerClassLoaderWithMBeanServer(ClassLoader classLoader) throws Exception { if (mbeanServer == null) return; if (classLoader instanceof RealClassLoader == false) return; RealClassLoader jmxClassLoader = (RealClassLoader) classLoader; ObjectName name = jmxClassLoader.getObjectName(); if (mbeanServer.isRegistered(name)) return; mbeanServer.registerMBean(classLoader, name); }
public URL getResource(String name) { // See if it is cached at a global level URL resource = parent.getCachedResource(name); // Not cached if (resource == null) { // Standard loading looks at the bootstrap classloader if (standard) resource = super.getResource(name); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) resource = getParent().getResource(name); else resource = SecurityActions.getParentClassLoader(this).getResource(name); } } return resource; } }
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First see if we already know it Class<?> clazz = findLoadedClass(name); // Next see if it is cached at a more global level if (clazz == null) clazz = parent.getCachedClass(name); // Not cached if (clazz == null) { // Standard loading looks at the bootstrap classloader if (standard) clazz = super.loadClass(name, resolve); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) clazz = getParent().loadClass(name); else { clazz = SecurityActions.getParentClassLoader(this).loadClass(name); } } } // Do we need to resolve the class? if (resolve) resolveClass(clazz); return clazz; }
/** * Unregister the classloader from the mbeanserver * * @param classLoader the classloader * @throws Exception for any error */ protected void unregisterClassLoaderFromMBeanServer(ClassLoader classLoader) throws Exception { if (mbeanServer == null) return; if (classLoader instanceof RealClassLoader == false) return; RealClassLoader jmxClassLoader = (RealClassLoader) classLoader; ObjectName name = jmxClassLoader.getObjectName(); if (mbeanServer.isRegistered(name) == false) return; mbeanServer.unregisterMBean(name); }
public URL getResource(String name) { // See if it is cached at a global level URL resource = parent.getCachedResource(name); // Not cached if (resource == null) { // Standard loading looks at the bootstrap classloader if (standard) resource = super.getResource(name); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) resource = getParent().getResource(name); else resource = SecurityActions.getParentClassLoader(this).getResource(name); } } return resource; } }
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First see if we already know it Class<?> clazz = findLoadedClass(name); // Next see if it is cached at a more global level if (clazz == null) clazz = parent.getCachedClass(name); // Not cached if (clazz == null) { // Standard loading looks at the bootstrap classloader if (standard) clazz = super.loadClass(name, resolve); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) clazz = getParent().loadClass(name); else { clazz = SecurityActions.getParentClassLoader(this).loadClass(name); } } } // Do we need to resolve the class? if (resolve) resolveClass(clazz); return clazz; }
/** * Unregister the classloader from the mbeanserver * * @param classLoader the classloader * @throws Exception for any error */ protected void unregisterClassLoaderFromMBeanServer(ClassLoader classLoader) throws Exception { if (mbeanServer == null) return; if (classLoader instanceof RealClassLoader == false) return; RealClassLoader jmxClassLoader = (RealClassLoader) classLoader; ObjectName name = jmxClassLoader.getObjectName(); if (mbeanServer.isRegistered(name) == false) return; mbeanServer.unregisterMBean(name); }
public URL getResource(String name) { // See if it is cached at a global level URL resource = parent.getCachedResource(name); // Not cached if (resource == null) { // Standard loading looks at the bootstrap classloader if (standard) resource = super.getResource(name); // We should really let the parent decide to do that else { if(System.getSecurityManager() == null) resource = getParent().getResource(name); else resource = SecurityActions.getParentClassLoader(this).getResource(name); } } return resource; } }
/** * Register a classloader with the MBeanServer * * @param cl the classloader */ protected void registerClassLoaderMBean(ClassLoader cl) { if (mbeanServer == null) return; if (cl instanceof RealClassLoader) { ObjectName name = ((RealClassLoader) cl).getObjectName(); try { mbeanServer.registerMBean(cl, name); } catch (Exception e) { log.warn("Error registering classloader: " + cl, e); } } }
/** * Unregister a classloader from the MBeanServer * * @param cl the classloader */ protected void unregisterClassLoaderMBean(ClassLoader cl) { if (mbeanServer == null) return; if (cl instanceof RealClassLoader) { ObjectName name = ((RealClassLoader) cl).getObjectName(); try { mbeanServer.unregisterMBean(name); } catch (Exception e) { log.warn("Error unregistering classloader: " + cl, e); } } }
/** * Unregister a classloader from the MBeanServer * * @param cl the classloader */ protected void unregisterClassLoaderMBean(ClassLoader cl) { if (mbeanServer == null) return; if (cl instanceof RealClassLoader) { ObjectName name = ((RealClassLoader) cl).getObjectName(); try { mbeanServer.unregisterMBean(name); } catch (Exception e) { log.warn("Error unregistering classloader: " + cl, e); } } } }
public ObjectName getClassLoaderName() { ClassLoader classLoader = getClassLoader(); if (classLoader == null || classLoader instanceof RealClassLoader == false) return null; return ((RealClassLoader) classLoader).getObjectName(); }
/** * Register a classloader with the MBeanServer * * @param cl the classloader */ protected void registerClassLoaderMBean(ClassLoader cl) { if (mbeanServer == null) return; if (cl instanceof RealClassLoader) { ObjectName name = ((RealClassLoader) cl).getObjectName(); try { mbeanServer.registerMBean(cl, name); } catch (Exception e) { log.warn("Error registering classloader: " + cl, e); } } }