/** * Find a coprocessor environment by class name * * @param className the class name * @return the coprocessor, or null if not found */ public CoprocessorEnvironment findCoprocessorEnvironment(String className) { for (E env : coprocessors) { if (env.getInstance().getClass().getName().equals(className) || env.getInstance().getClass().getSimpleName().equals(className)) { return env; } } return null; }
/** * Retrieves the set of classloaders used to instantiate Coprocessor classes defined in external * jar files. * * @return A set of ClassLoader instances */ Set<ClassLoader> getExternalClassLoaders() { Set<ClassLoader> externalClassLoaders = new HashSet<ClassLoader>(); final ClassLoader systemClassLoader = this.getClass().getClassLoader(); for (E env : coprocessors) { ClassLoader cl = env.getInstance().getClass().getClassLoader(); if (cl != systemClassLoader) { // do not include system classloader externalClassLoaders.add(cl); } } return externalClassLoaders; }