camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-4009) Fast @Converter loading in uber-jar
Date Sun, 29 May 2011 08:08:47 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-4009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040762#comment-13040762
] 

Claus Ibsen commented on CAMEL-4009:
------------------------------------

Its the pluggable class resolvers
http://camel.apache.org/pluggable-class-resolvers.html

There is a jboss component for jboss5 and jboss6 at
http://code.google.com/a/apache-extras.org/p/camel-extra/?redir=1

And there is a camel-eclipse in the distro, but we can adjust it if really needed
http://camel.apache.org/camel-eclipse.html

And people could potentially have extended the DefaultPackageScanClassResolver and override
the protected methods. So we just have to be a little careful.

So maybe take a 2nd look and try to be as compliant as possible. And polish the code, so its
not ugly. Then we can take a 2nd look.

> Fast @Converter loading in uber-jar
> -----------------------------------
>
>                 Key: CAMEL-4009
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4009
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.7.0
>            Reporter: Arkadi Shishlov
>            Priority: Minor
>              Labels: uber-jar
>             Fix For: Future
>
>         Attachments: apache-camel-r1127037-fast-TypeConverter-loading-in-uber-jar.diff
>
>
> Currently, the @Converter converters are loaded as follows
> {noformat}
> for package in TypeConverter meta-inf resource
>   get package url from classloader
>   if url is jar
>     for entries in jar
>       if entry match package
>         check annotation
> {noformat}
> This is very inefficient approach when application is packaged into uber-jar as expensive
iteration is performed multiple times over same jar.
> The attached patch changes loop into:
> {noformat}
> for package in TypeConverter meta-inf resource
>   get package url from classloader
>   create map url -> package names
>   for url in distinct url
>     if jar
>       for entries in jar
>         for package in packages
>           if entry match package
>             check annotation
> {noformat}
> With this patch I was able to cut startup time significantly from 15sec spent on @Converter-s
load to 2sec on 45MB 29k entries uber-jar.
> I understand that the solution is not pretty but resolves a very practical problem. Let
me know if you want me to polish it and update the javadoc.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message