Title: RE: Contention on Class Loader for Extensions class

Padraig:

> Which class loader do you think was being used ? It may be an
> artefact of that class loader. For example Tomcat 3.1b will
> automatically reload servlets from the web-inf directory if you
> recompile it (as long as it was not loaded from the class path).

Looking at the stack traces produced by OptimizeIt Thread Debugger, it seems
to be sun/misc/Launcher$AppClassLoader and sun/misc/Launcher$ExtClassLoader.

> Presumably to do this it can't immediately return the already loaded
> class, it has to hit the disk to check the last modification time of the
> .class file to see if it is newer than the class already loaded which
> may slow the whole process down a lot.

That would explain a lot, though it seems like my threads are not using
that particular class loader.  I am using Tomcat 3.2.3, though...

> Also, is it possible that OptimizeIt is using its own class loader
> to instrument the classes being loaded so it can profile their behaviour
> better and the behaviuor you are seeing is a side effect of that ?

It doesn't seem that way. 

I appreciate your and Gary (Peskin's) feedback on this issue.  Its helped me
to understand better how the Xalan code works...

Gary Peskin wrote:
> I'm not sure how you'd do this.  We should only be doing it once per
> transform.  Multiple transforms on the same thread can use different
> transformers so I'm not sure what you'd do.  I don't think you're
> incurring much cost.  Once the classloader sees that it's already
> loaded, it should return with the previously loaded version.

I'm afraid that I don't know the internals of the Xalan code well enough
to reply.  Our code is a Java class that makes repeated (sometimes up to
1000) calls to XPathAPI.selectSingleNode() in the same thread.  Is that a
single transform?  A single transformers?  In this single Java instance
the DOM is the same throughout.  I realize that this is inefficient right
away (as our implementation should record those key nodes and reuse their
positions instead of re-finding them each time).

Would you be able to recommend a way to optimize this case, perhaps using
some lower-level APIs/classes?  In our scenario, the class is converting
a DOM tree into HTML using selectSingleNode and selectNodes. 

Thanks again for all of your help.  Perhaps I am interpreting the OptimizeIt
results too quickly...

Thanks,
Glenn

Reply via email to