Writing headers is not threadsafe in StatefulBeanToCsv
Brought to you by:
aruckerjones,
sconway
I just saw a file with two headers. Looking at the code I see that writing headers is not threadsafe. Which would be fine if StatefulBeanToCsv is not intended to be threadsafe. I don't see any comment suggesting so, but I do see a lot of data structures which do suggest threadsafty, like BlockingQueue or ConcurrentNavigableMap. It would be helpful to add a line to the JavaDoc if StatefulBeanToCsv is threadsafe or not. If it should be threadsafe, writing the headers needs to be fixed, by e.g. using a AtomicBoolean.
StatefulBeanToCsv implements multithreading on writing beans itself, so there should be no pressing need to use it in multiple threads. It is not thread-safe and is not intended to be. I have added a comment to the Javadoc for the class, but the comment is part of another development that will not be committed for a while.