public void removeClassLoader() { if (classLoaderFactory == null) return; try { classLoaderFactory.removeClassLoader(this); } catch (Throwable t) { log.warn("Error removing classloader for " + getName(), t); } classLoaderFactory = null; setClassLoader(null); }
public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(this); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }
public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(getDeploymentUnit()); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } else { // No classloader, use the deployer's classloader setClassLoader(Thread.currentThread().getContextClassLoader()); } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }
public void removeClassLoader() { if (classLoaderFactory == null) return; try { classLoaderFactory.removeClassLoader(getDeploymentUnit()); } catch (Throwable t) { log.warn("Error removing classloader for " + getName(), t); } classLoaderFactory = null; setClassLoader(null); }