camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Speed up marshalling objects to XML by explicitly loading classes
Date Fri, 30 Nov 2012 12:23:30 GMT
Hi

No there is not.

Maybe if you specify a JAXB data format, and with the contextPath,
then JAXB may load these on startup. Not sure though.



On Tue, Nov 27, 2012 at 12:07 PM, Ben V <venckus.benas@gmail.com> wrote:
> I have lots of xsd and create java classes from them (~1000 classes) using
> xjc and deployed them to Servicemix4 as an OSGI bundle.
> Then I have application where I process the request and set exchange body to
> some object from generated classes.
> The problem is when it processes the first request - it takes around ~10
> seconds (JAXB to marshal object and set Exchange Body to XML??).
> Other requests runs without any time loss...
>
> Is there a way to speed up first request and explicitly load all generated
> classes when I deploy my bundle?
>
> -------------------
> camelContext:
> <camelContext id="cds_context"
> xmlns="http://camel.apache.org/schema/blueprint">
>     <route>
>         <from uri="cxfrs:bean:rsServer?bus=#cxf-bus" />
>         <to uri="requestProcessor" />
>         <to uri="log:REQUEST?level=DEBUG&amp;multiline=true" />
>         <to uri="nmr:http://example.com/some_routing" />
>         <to uri="log:RESPONSE?level=DEBUG&amp;multiline=true" />
>     </route>
> </camelContext>
> -------------------
> requestProcessor:
> import my.package.Subscription;
> ...
> public void process(Exchange exchange) throws Exception {
>     ....
>     Subscription subr = new Subscription();
>     subr.setNumber("123");
>     exchange.getOut().setBody(subr, Subscription.class);
>     log.debug("process DONE");
>     .....
> }
> -------------------
> First request:
> 2012-11-27 12:33:09,797 | DEBUG  | qtp24871952-549  | RequestProcessor
> | 176 - my_bundle - 1.0.0.SNAPSHOT | process DONE
> 2012-11-27 12:33:18,045 | DEBUG  | qtp24871952-549  | RQUEST
> | 91 - org.apache.camel.camel-core - 2.8.5 | Exchange[
> , ExchangePattern:InOut
> , BodyType:my.package.Subscription
> , Body:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <ns8:subscription xmlns:ns8="http://omnitel.lt/cdm">
>     <ns8:number>123</ns8:number>
> </ns8:subscription>
> ]
> -------------------
> Other requests:
> 2012-11-27 12:36:48,053 | DEBUG  | qtp24871952-549  | RequestProcessor
> | 176 - my_bundle - 1.0.0.SNAPSHOT | process DONE
> 2012-11-27 12:36:48,055 | DEBUG  | qtp24871952-549  | RQUEST
> | 91 - org.apache.camel.camel-core - 2.8.5 | Exchange[
> , ExchangePattern:InOut
> , BodyType:my.package.Subscription
> , Body:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <ns8:subscription xmlns:ns8="http://omnitel.lt/cdm">
>     <ns8:number>123</ns8:number>
> </ns8:subscription>
> ]
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Speed-up-marshalling-objects-to-XML-by-explicitly-loading-classes-tp5723299.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message