camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Tombs <>
Subject Freeing objects returned by type converter
Date Fri, 07 Jan 2011 14:51:48 GMT
Hello all,

I have recently started using camel and it's fantastic. Thanks for all
your hard work, committers.

One issue I came across is whether I should free or close objects
returned by a type converter. For example, I have a class that reads
some binary data from an InputStream so I wrote a custom Processor
that does this:

InputStream productStream = exchange.getIn().getBody(InputStream.class);

It appears that I need to call close() on productStream or else my
file consumer was leaving open handles to the source files. Is this
always the case? If the body was already an InputStream, would calling
close() be harmful? Am I doing something wrong?

I couldn't find anything in the documentation regarding this--type
converters were always used to convert to Strings in examples.

Thanks in advance,

Wise men _still_ seek Him.

View raw message