/** * Create a new DelegatingClassLoader. * * @param parent the parent */ public DelegatingClassLoader(RealClassLoader parent) { super(checkParent(parent)); this.parent = parent; }
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; }
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; } }
/** * 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; }
/** * 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; } }
/** * Create a new DelegatingClassLoader. * * @param parent the parent */ public DelegatingClassLoader(RealClassLoader parent) { super(checkParent(parent)); this.parent = parent; }
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; } }
/** * Create a new DelegatingClassLoader. * * @param parent the parent */ public DelegatingClassLoader(RealClassLoader parent) { super(checkParent(parent)); this.parent = parent; }
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); }
/** * Create a new DelegatingClassLoader. * * @param parent the parent */ public DelegatingClassLoader(RealClassLoader parent) { super(checkParent(parent)); this.parent = parent; }
public ObjectName getClassLoaderName() { ClassLoader classLoader = getClassLoader(); if (classLoader == null || classLoader instanceof RealClassLoader == false) return null; return ((RealClassLoader) classLoader).getObjectName(); }
public ObjectName getClassLoaderName() { ClassLoader classLoader = getClassLoader(); if (classLoader == null || classLoader instanceof RealClassLoader == false) return null; return ((RealClassLoader) classLoader).getObjectName(); }
public List<ObjectName> listClassLoaders() { List<ObjectName> result = new ArrayList<ObjectName>(); for (ClassLoader cl : super.getAllClassLoaders()) { if (cl instanceof RealClassLoader) result.add(((RealClassLoader) cl).getObjectName()); } return result; }
public List<ObjectName> listClassLoaders() { List<ObjectName> result = new ArrayList<ObjectName>(); for (ClassLoader cl : super.getAllClassLoaders()) { if (cl instanceof RealClassLoader) result.add(((RealClassLoader) cl).getObjectName()); } return result; }