Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D4AFE6C51 for ; Sat, 28 May 2011 20:09:28 +0000 (UTC) Received: (qmail 57644 invoked by uid 500); 28 May 2011 20:09:28 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 57608 invoked by uid 500); 28 May 2011 20:09:28 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 57600 invoked by uid 99); 28 May 2011 20:09:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 May 2011 20:09:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 May 2011 20:09:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 557C2E51DB for ; Sat, 28 May 2011 20:08:47 +0000 (UTC) Date: Sat, 28 May 2011 20:08:47 +0000 (UTC) From: "Arkadi Shishlov (JIRA)" To: dev@camel.apache.org Message-ID: <679260421.51153.1306613327347.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1048904353.39264.1306247147484.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CAMEL-4009) Fast @Converter loading in uber-jar MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-4009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040667#comment-13040667 ] Arkadi Shishlov commented on CAMEL-4009: ---------------------------------------- bq. We cannot break the API as there are 3rd party type converter loaders that depend on the current API. Could you please point me to them so I could evaluate the impact? bq. So if you can find a way without breaking the API we may consider the patch. And yes we prefer patches that have been polished and documented. I believe the public API is not broken. I only changed _protected find()_ signatures and semantic of _customResourceLocator()_ is left intact. I can add original _find(String package)_ if you wish. Otherwise, is it ok? > 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