camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GegeFR <>
Subject free resources when error happen splitting with custom method
Date Tue, 11 Aug 2015 12:29:11 GMT
Hi, I'm currently handling quite big files in camel (100s of MB).

I'm splitting the file in multiple chunk. In order to be able to do it
without fully loading the file into memory, i use a custom split method,
that generates an iterator.

That iterator is wrapping a "Reader" that read multiple lines when next() is
called, and then generates a message. Everything is OK and memory usage is
very low, perfect.

I made sure i closed my reader when i'm finished or if an error happend in
the iterator (things like IOExceptions).

However when an error happen IN the <split> </split>, like, when sending the
data to kafka, then my iterator does not seem to know it, and cannot close
the Reader and the file stays open.

So ... Later ... When trying again the file, it cannot be locked (rename).

Is there a way for my iterator to know when an error happens later in the
route, so that it can free the reader or inputstream ? 


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message