camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Edstrom <jedst...@savoirtech.com>
Subject Re: [jira] [Commented] (CAMEL-3776) Add pooling support for JAXB data format
Date Mon, 02 Apr 2012 21:12:01 GMT
I have implemented this for other things, you really need to pool the marshallers/unmarshallers
in an Object Pool or something similar.
One way was to override and extend / override the whole context.



On Apr 2, 2012, at 3:07 PM, Christian Müller (Commented) (JIRA) wrote:

> 
>    [ https://issues.apache.org/jira/browse/CAMEL-3776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244627#comment-13244627
] 
> 
> Christian Müller commented on CAMEL-3776:
> -----------------------------------------
> 
> By using the XMLStreamReader in FallbackTypeConverter and a shared Unmarshaller, I also
got the NullpointerException from JAXB:
> {noformat}
> java.lang.NullPointerException
> 	at com.sun.xml.bind.v2.runtime.Coordinator.popCoordinator(Coordinator.java:157)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:461)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:332)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.unmarshal(FallbackTypeConverter.java:204)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.unmarshall(FallbackTypeConverter.java:139)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:91)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:204)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:141)
> 	at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)
> 	at org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:58)
> 	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)
> 	at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> 	at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
> 	at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
> 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
> 	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:352)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:324)
> 	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:223)
> 	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:324)
> 	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:169)
> 	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:111)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:124)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:342)
> 	at org.apache.camel.example.DataFormatConcurrentTest$2.run(DataFormatConcurrentTest.java:74)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:680)
> {noformat}
> 
> And as documented in [1], the Unmarshaller from Jaxb Impl RI (Oracle) is not thread safe.
> I pinged Dan to get a pointer to the CXF code where they share the Unmarshaller...
> 
> [1] http://jaxb.java.net/guide/Performance_and_thread_safety.html
> 
>> Add pooling support for JAXB data format
>> ----------------------------------------
>> 
>>                Key: CAMEL-3776
>>                URL: https://issues.apache.org/jira/browse/CAMEL-3776
>>            Project: Camel
>>         Issue Type: New Feature
>>         Components: camel-jaxb
>>           Reporter: Claus Ibsen
>>            Fix For: 3.0.0
>> 
>>        Attachments: jaxb-pool.patch
>> 
>> 
>> We should use the ServicePool in camel-core to pool JAXB / marshaller / unmarshaller.
>> Of course ppl should be able to customize pool settings and if to be used.
>> Also mind that for type converters with JAXB you do not configure a JAXB data format.
And thus we should
>> still be able to configure and use pooling, so the type converter can be more efficient.
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
> 


Mime
View raw message