[jboss-cvs] JBossAS SVN: r66304 - in projects/microcontainer/trunk: deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 19 14:58:48 EDT 2007
Author: kabir.khan at jboss.com
Date: 2007-10-19 14:58:47 -0400 (Fri, 19 Oct 2007)
New Revision: 66304
Modified:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractTopLevelClassLoaderSystemDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java
Log:
When destroying the top-level classloader, destroy the vfsmemory root for the classloader
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractTopLevelClassLoaderSystemDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractTopLevelClassLoaderSystemDeployer.java 2007-10-19 18:58:02 UTC (rev 66303)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractTopLevelClassLoaderSystemDeployer.java 2007-10-19 18:58:47 UTC (rev 66304)
@@ -174,8 +174,10 @@
{
// Reset the module to avoid possible memory leaks
Module module = context.getTransientAttachments().getAttachment(Module.class);
+
if (module == null)
throw new IllegalStateException("Deployment Context has no module: " + context);
+ cleanup(context, module);
module.reset();
}
}
@@ -232,4 +234,15 @@
* @throws Exception for any error
*/
protected abstract ClassLoaderPolicy createTopLevelClassLoaderPolicy(DeploymentContext context, Module module) throws Exception;
+
+ /**
+ * Hook to perform cleanup on destruction of classloaader
+ *
+ * @param context the deployment context
+ * @param module the module
+ * @throws Exception for any error
+ */
+ protected void cleanup(DeploymentContext context, Module module) throws Exception
+ {
+ }
}
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java 2007-10-19 18:58:02 UTC (rev 66303)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSTopLevelClassLoaderSystemDeployer.java 2007-10-19 18:58:47 UTC (rev 66304)
@@ -30,7 +30,6 @@
import org.jboss.deployers.vfs.spi.structure.helpers.ClassPathVisitor;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
-import org.jboss.virtual.spi.VFSContext;
/**
* VFSTopLevelClassLoaderSystemDeployer.
@@ -53,7 +52,7 @@
roots[i++] = path;
MemoryContextFactory factory = MemoryContextFactory.getInstance();
- VFSContext ctx = factory.createRoot(module.getDynamicClassRoot());
+ factory.createRoot(module.getDynamicClassRoot());
URL url = new URL(module.getDynamicClassRoot() + "/classes");
roots[i++] = factory.createDirectory(url).getVirtualFile();
@@ -64,4 +63,12 @@
// TODO JBMICROCONT-182 more policy from "module"
return policy;
}
+
+ @Override
+ protected void cleanup(DeploymentContext context, Module module) throws Exception
+ {
+ MemoryContextFactory factory = MemoryContextFactory.getInstance();
+ factory.deleteRoot(module.getDynamicClassRoot());
+ }
+
}
More information about the jboss-cvs-commits
mailing list