Thanx for helping...
Well i put here my Converter's code... As you can see i had the
"Transformer" as
an instance variable, but there go the concurrency issues....
Right now i've commented it and make an instance every time right before
transformation.
This MidBuffer2CanonicXML-Class is the heavyweight one...
i have read in documentation of the type converters that they get cached
when defined not static...
But can i influence camel to use a new cached instance when a new exchange
gets worked at?
@Converter
public class ObjectNet2Document {
// protected Transformer<MidBufferHeader, Document> transformer =
new MidBuffer2CanonicXML();
@Converter
public Document process(byte[] raw) throws Exception {
int rawSize = raw.length;
MidBufferHeader mbh = new MidBufferHeader(raw, 0, rawSize);
Transformer<MidBufferHeader, Document> transformer = new
MidBuffer2CanonicXML();
Document document = transformer.transform(mbh);
return document;
}
}
Martin
willem.jiang wrote:
>
> How did you user the TypeConverter?
> If you can cache the CamelContext, I think you will create a new
> TypeConverter each time.
> BTW,
> With the recent change of CAMEL-2392[1], CamelContext will load the
> TypeConverter when the CamelContext is started.
>
> [1] https://issues.apache.org/activemq/browse/CAMEL-2392
>
> Willem
>
--
View this message in context:
http://old.nabble.com/Heavyweight-Converter%3A-Caching--tp27337830p27338187.html
Sent from the Camel - Users mailing list archive at Nabble.com.