Jul 29th, 2011, 09:22 PM
When does TransactionAwareBufferedWriter automatically close its underlying Writer?
I'm working on my own ItemWriter implementation so I've been studying the logic in the FlatFileItemWriter class, and one thing does not make sense to me: Under what circumstances would a TransactionAwareBufferedWriter automatically close its underlying Writer (i.e. the logic in the complete() method)? Why wouldn't itemStream.close() be called instead?
Jul 31st, 2011, 01:18 PM
Ah, I think I get it. If itemStream.close() is called when a transaction is in flight, the call to close the underlying stream is delayed until the transaction is committed and the buffer is flushed.