public void resetThreadContextLoader() { if (LoaderUtils.isContextLoaderAvailable() && this.isContextLoaderSaved) { LoaderUtils.setContextClassLoader(this.savedContextLoader); this.savedContextLoader = null; this.isContextLoaderSaved = false; } }
public void setThreadContextLoader() { if (this.isContextLoaderSaved) { throw new BuildException("Context loader has not been reset"); } if (LoaderUtils.isContextLoaderAvailable()) { this.savedContextLoader = LoaderUtils.getContextClassLoader(); ClassLoader loader = this; if (this.project != null && "only".equals(this.project.getProperty("build.sysclasspath"))) { loader = this.getClass().getClassLoader(); } LoaderUtils.setContextClassLoader(loader); this.isContextLoaderSaved = true; } }