tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Re-factoring TLD parsing
Date Fri, 17 Aug 2012 07:56:18 GMT

Christopher Schultz <> wrote:

>The first item in the TOMCAT-NEXT.txt is this:
> 1. Refactor the TLD parsing. TLDs are currently parsed twice. Once by
>    Catalina looking for listeners and once by Jasper.
>I had a conversation in Vancouver with David Blevins about the scourge
>of JAR-scanning in general (in that case, we were discussing
>annotation-processing) and I suggested that a generic JAR scanner could
>be built that would simply scan JARs and emit events like "found
>annotation" or "found JAR" or "found file" or whatever.

There is work in Commons on a class scanning component.

>I don't know enough about how Catalina and Jasper each handle these
>things, but would such a scanning component be helpful to them?


Your e-mail landed in my inbox just as I was starting to think about BZ 53714. In light of
the recent clarifications from the Servlet EG and that BZ, I think it is worth reviewing:
- how we identify JARs (or JAR like directories)
- what we might need to scan for in each JAR (web fragments, SCIs, annotations, TLDs, ???)
- the options available to the user for skipping the scanning of JARs known not to contain
things of interest (Spec and Tomcat specific)
- any ordering constraints
- options for caching results (particularly of JARs in the common or shared class loaders)
- performance considerations (e.g. it might be faster to scan once for everything even if
we suspect we might be able to skip some aspects of the scan)

> If both
>components (Catalina and Jasper, other components) could register event
>handlers with the scanner, the number of times each JAR would be
>would be limited to 1.

Yes, with the caveat that it depends on the type of scan. Checking for an SCI or web-fragment
is a lot faster than scanning all classes for annotations. TLDs are a little slower than checking
for an SCI but not much.

>Perhaps this strategy could be extended to TLD processing as well: the
>scanner could be configured to send TLD-specific notifications (or
>just have a TLD-specific listener registered with the scanner that
>generates events like "read TLD component" or what have you).
>I guess the question is whether each component (Catalina, Jasper,
>whatever add-ons might be interested in similar information) can
>register their interest in receiving notification of these kinds of
>events. Is there a convenient place where components hosted by Catalina
>could naturally register for these kinds of events (or even request
>a JAR scan occur)?

The benefits of refactoring the TLD scanning are mainly that we currently do it twice and
we don't do it fully in terms of tracking dependencies. There is clear scope for improvement

>Is this kind of thing overkill, or does it sound like it would be a
>truly useful utility?

Potentially but we need to get a better grip on all the requirements. Given the refactoring
aspects, this will probably remain a 8.0.x solution although BZ 53714 needs solving for 7.0.x
as well. For backwards compatibility reasons I think it makes sense to figure out the 8.0.x
solution and then back-port it.

An added complication is the resources refactoring I am working on. That will have an impact
on JarScanner although I'm not sure exactly what at this point.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message