use of org.apache.sling.commons.classloader.DynamicClassLoaderManager in project sling by apache.
the class FSClassLoaderProvider method destroyClassLoader.
private void destroyClassLoader() {
final ClassLoader rcl = this.loader;
if (rcl != null) {
this.loader = null;
final ServiceReference<DynamicClassLoaderManager> localDynamicClassLoaderManager = this.dynamicClassLoaderManager;
final Bundle localCallerBundle = this.callerBundle;
if (localDynamicClassLoaderManager != null && localCallerBundle != null) {
localCallerBundle.getBundleContext().ungetService(localDynamicClassLoaderManager);
}
}
}
use of org.apache.sling.commons.classloader.DynamicClassLoaderManager in project sling by apache.
the class ClassLoaderWriterImpl method getOrCreateClassLoader.
private synchronized RepositoryClassLoader getOrCreateClassLoader() {
if (this.repositoryClassLoader == null || !this.repositoryClassLoader.isLive()) {
// make sure to cleanup any existing class loader
this.destroyRepositoryClassLoader();
// get the dynamic class loader for the bundle using this
// class loader writer
final DynamicClassLoaderManager dclm = (DynamicClassLoaderManager) this.callerBundle.getBundleContext().getService(this.dynamicClassLoaderManager);
this.repositoryClassLoader = new RepositoryClassLoader(this.classPath, this, dclm.getDynamicClassLoader());
}
return this.repositoryClassLoader;
}
use of org.apache.sling.commons.classloader.DynamicClassLoaderManager in project sling by apache.
the class GetPropertyTag method getClassLoader.
/**
* Method for retrieving the classloader from the OSGi console.
*
* @return the classloader
*/
protected ClassLoader getClassLoader() {
final SlingBindings bindings = (SlingBindings) pageContext.getRequest().getAttribute(SlingBindings.class.getName());
final SlingScriptHelper scriptHelper = bindings.getSling();
final DynamicClassLoaderManager dynamicClassLoaderManager = scriptHelper.getService(DynamicClassLoaderManager.class);
final ClassLoader classLoader = dynamicClassLoaderManager.getDynamicClassLoader();
return classLoader;
}
Aggregations