myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <simon.lessar...@gmail.com>
Subject Re: Scanning for annotated classes in MyFaces 2
Date Sun, 18 Jan 2009 20:19:22 GMT
Hi Cagatay,

The issue of what packages to scan is the responsibility of the
specification here however. We cannot simply decide to avoid some packages
in this case, we have to wait for the spec to normalize a way to define
those.


Regards,

~ Simon

On Sun, Jan 18, 2009 at 8:50 AM, Cagatay Civici <cagatay.civici@gmail.com>wrote:

> Hi Jan,
>
> Thanks for your contribution, yes this could be done without adding a
> dependency.
>
> We could avoid reflection stuff and use byte code exploring. Mojarra 2.0
> uses code from Glassfish codebase for this byte code stuff btw. You may take
> a look at their implementation to give an idea.
>
> I agree that a custom scan path should fasten the app startup time a lot,
> usually the annotated classes belong to a certain package in our apps like
>
> com.mycompany.myproject.*
>
> Cheers,
>
> Cagatay
>
>
> On Sun, Jan 18, 2009 at 1:41 PM, Jan-Kees van Andel <
> jankeesvanandel@gmail.com> wrote:
>
>> 2009/1/11 Matthias Wessendorf <matzew@apache.org>:
>> > On Sun, Jan 11, 2009 at 4:46 AM, Mario Ivankovits <mario@ops.co.at>
>> wrote:
>> >
>> > ;-) I really hate to wait on the boot-up.
>> > :-)
>> >
>> > --
>> > Matthias Wessendorf
>> >
>> > blog: http://matthiaswessendorf.wordpress.com/
>> > sessions: http://www.slideshare.net/mwessendorf
>> > twitter: http://twitter.com/mwessendorf
>> >
>>
>> Last week I've been playing around with a (non-Reflection) classpath
>> scanner of my own. It's actually not that hard to write (if you have
>> the class file format specification somewhere for reference) and my
>> experience until now is that it's much faster than using Reflection.
>>
>> I have a test webapp which I deploy on Tomcat. This webapp contains
>> about 650 classes.
>>
>> With reflection, it takes about 1500ms to read them all, with my
>> custom home brewn scanner, it only takes between 300ms and 350ms.
>> The only performance tweak I have made was a BufferedInputStream, so
>> I'm sure there is enough room for other improvements (maybe some
>> fork-join algorithm to support parallelism).
>> I haven't really tested memory footprint yet, but 650 classes is still
>> not that much.
>>
>> Current status (I do this in spare time ;-)):
>> - Expose the parsed classes in a developer-friendly format, instead of
>> the raw class file format. (it's like a lite version of the Reflection
>> API, to keep it fast).
>> - Read classes in jars.
>> - Test for possible ClassLoader issues.
>> - Allow users to specify their own searchpaths.
>> - Package filtering.
>> - Search/filter API to allow the developer to only load classes that
>> implement some interface or are tagged with an annotation.
>>
>> If I'm satisfied with the results, we can see if it may fit into
>> MyFaces (or maybe a reusable utility, since there are other projects
>> that need to scan for annotations).
>> It's not that much code and this way there is no need for an
>> additional dependency.
>>
>> I'll keep you guys informed.
>>
>> Regards,
>>
>> /Jan-Kees
>>
>
>

Mime
View raw message