[jboss-user] [JBoss Microcontainer Development] - Classloading and caching changes

Ales Justin do-not-reply at jboss.com
Fri May 14 10:17:24 EDT 2010

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

"Classloading and caching changes"

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

It all started as a performance issue.
> A web app is using xerces, trying to load its DocumentBuilder class a lot (really a lot).
> Changing "useLoadClassForParent" on default domain doesn't help a lot.
> And the class isn't cached in domain's globalClassCache.
> The problem is that that DB xerces class is loaded in this block (xerces is in JBOSS_HOME/lib), but it's never cached.
> Hence BaseClassLoader always goes into domain and its synch block.
> Couldn't we cache something more inside this block?
> Went over the forums these past days, to find anything on the topic, and I found this:
> *  http://community.jboss.org/thread/127814?start=15&tstart=0 http://community.jboss.org/thread/127814?start=15&tstart=0
When you have one domain delegating to another domain, it doesn't check
the parent domain cache until after it has entered the synchronization block.

There are two possible fixes:

1) Introduce some extra logic into the domain cache checking that knows
about the parent delegation. That needs to be done carefully otherwise
it will check the wrong cache for the parent delegation rules.
i.e. it needs to differentiate classes loaded from the parent 
before/after the class load in the domain.

2) Cache the result from the parent in the child domain.
This has the issues mentioned on the forum thread

i) it doesn't differentiate what is loaded before or after the load from
the target domain
ii) it complicates the flushing in the event that the parent domain gets
flushed, e.g. a classloader is removed from the parent domain

I think (1) would be the best way to optimize it, by adding
checkParentCacheBefore/After() logic into the current cache checking
that gets invoked outside the synchronization block.


Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100514/2ec96b07/attachment-0001.html 

More information about the jboss-user mailing list