Announcement Announcement Module
Collapse
No announcement yet.
FlatFileItemWriter does not guarantee data is physically written to disk Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlatFileItemWriter does not guarantee data is physically written to disk

    From what I can see FlatFileItemWriter does not guarantee that data is physically written to disk. The FlatFileItemWriter calls flush() and the javadoc states the following:

    Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

    If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
    If you want to ensure the data is physically written to disk, you should call java.io.FileDescriptor#sync or java.nio.channels.FileChannel#force.

    http://stackoverflow.com/questions/5...nc-both-needed
    http://www.exampledepot.com/egs/java.io/Sync.html
    http://www.javalobby.org/java/forums/t15716.html
    Last edited by jpraet; Oct 31st, 2011, 02:25 PM.
Working...
X