Menu

#166 Writing headers is not threadsafe in StatefulBeanToCsv

v1.0 (example)
closed-fixed
None
5
2018-02-26
2018-02-24
No

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.

Discussion

  • Andrew Rucker Jones

    • status: open --> closed-fixed
    • assigned_to: Andrew Rucker Jones
     
  • Andrew Rucker Jones

    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.

     

Log in to post a comment.

Monday.com Logo