@Override protected synchronized Class<?> loadClass(String classname, boolean resolve) throws ClassNotFoundException { Class<?> theClass = findLoadedClass(classname); if (theClass != null) { return theClass; } if (isSplit(classname)) { theClass = findClass(classname); if (resolve) { resolveClass(theClass); } return theClass; } return super.loadClass(classname, resolve); }
/** * Removes a classloader if needed. * @since Ant 1.7 */ private void deleteClassLoader() { if (classLoader != null) { classLoader.cleanup(); classLoader = null; } if (mirrorLoader instanceof SplitClassLoader) { ((SplitClassLoader) mirrorLoader).cleanup(); } mirrorLoader = null; }
protected void setupFTPDelegate() { ClassLoader myLoader = FTPTask.class.getClassLoader(); if (mustSplit()) { mirrorLoader = new SplitClassLoader(myLoader, classpath, getProject(), new String[] { "FTPTaskMirrorImpl", "FTPConfigurator" }); } else { mirrorLoader = myLoader; } delegate = createMirror(this, mirrorLoader); }
/** * Runs the task. * * @throws BuildException if the task fails or is not configured * correctly. */ @Override public void execute() throws BuildException { checkAttributes(); try { setupFTPDelegate(); delegate.doFTP(); } finally { if (mirrorLoader instanceof SplitClassLoader) { ((SplitClassLoader) mirrorLoader).cleanup(); } mirrorLoader = null; } }
(PrivilegedAction<ClassLoader>) () -> new SplitClassLoader( myLoader, path, getProject(), new String[] {"BriefJUnitResultFormatter", "JUnit4TestMethodAdapter",