[jboss-user] [JBoss Microcontainer Development] - Removing cached entry in VFSCLPolicy on load

Ales Justin do-not-reply at jboss.com
Mon Jun 21 20:58:31 EDT 2010


Ales Justin [http://community.jboss.org/people/alesj] created the discussion

"Removing cached entry in VFSCLPolicy on load"

To view the discussion, visit: http://community.jboss.org/message/549039#549039

--------------------------------------------------------------
Does something like this make sense to add directly, or should it be optional?

   public VFSClassLoaderPolicy(String name, VirtualFile[] roots, VirtualFile[] excludedRoots)
   {
        ...
 
        this.excludedRoots = excludedRoots;
+      addClassFoundHandler(new VFSCacheRemove());
    }
 
+
+   private class VFSCacheRemove implements ClassFoundHandler
+   {
+      public void classFound(ClassFoundEvent event)
+      {
+         String className = event.getClassName();
+         String path = ClassLoaderUtils.classNameToPath(className);
+         vfsCache.remove(path); // remove the entry once we loaded the class
+      }
+   }
 }


This would definitely decrease the memory, since every already loaded class's lookup cache would be released.
And with CL cache fixed, we access the class on next invocaton directly form CL cache, hence no need to path cache.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/549039#549039]

Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100621/e54c0a2a/attachment.html 


More information about the jboss-user mailing list