public EarLibClassLoader(URL[] urls, ClassLoader classLoader) { super(classLoader); enableCurrentBeforeParent(); for (URL url : urls) { super.addURL(url); } }
@Override public void preDestroy() { if (isPreDestroyCalled) { return; } try { for (ClassLoaderHolder clh : moduleClassLoaders) { // destroy all the module classloaders if (!(clh.loader instanceof EarLibClassLoader) && !(clh.loader instanceof EarClassLoader) && !isRARCL(clh.loader)) { try { PreDestroy.class.cast(clh.loader).preDestroy(); } catch (Exception e) { // ignore, the class loader does not need to be // explicitly stopped. } } } // destroy itself super.preDestroy(); // now destroy embedded Connector CLs DelegatingClassLoader dcl = (DelegatingClassLoader) this.getParent(); for (DelegatingClassLoader.ClassFinder cf : dcl.getDelegates()) { try { PreDestroy.class.cast(cf).preDestroy(); } catch (Exception e) { // ignore, the class loader does not need to be // explicitly stopped. } } // now destroy the EarLibClassLoader PreDestroy.class.cast(this.getParent().getParent()).preDestroy(); moduleClassLoaders = null; } catch (Exception e) { // ignore, the class loader does not need to be explicitely stopped. } isPreDestroyCalled = true; }
/** * Closes the instance of AppClientInfo, deleting any temporary directory created and closing the * archive. * * @throws IOException in case of error closing the archive */ @Override protected void close() throws IOException { try { // XXX Mitesh helping to update this // if (puAppInfo != null) { // new PersistenceUnitLoaderImpl().unload(puAppInfo); // puAppInfo = null; // } if (appClientArchive != null) { appClientArchive.close(); } ClassLoader classLoader = getClassLoader(); if (classLoader != null && classLoader instanceof ASURLClassLoader) { ((ASURLClassLoader) classLoader).done(); } } finally { if (deleteAppClientDir()) { if (appClientArchive != null) { appClientArchive.delete(); } } appClientArchive = null; } }