[
https://issues.apache.org/jira/browse/CSV-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17505168#comment-17505168
]
Angus C commented on CSV-295:
-----------------------------
Is it good to add synchronized in the core library which cause performance
penalty to all single-threaded application? Can just lock the CSVPrinter in
your application?
> Support for parallelism in CSVPrinter
> -------------------------------------
>
> Key: CSV-295
> URL: https://issues.apache.org/jira/browse/CSV-295
> Project: Commons CSV
> Issue Type: Improvement
> Components: Printer
> Affects Versions: 1.9.0
> Environment:
> https://zio.dev/version-1.x/overview/overview_creating_effects#blocking-synchronous-side-effects
> Reporter: Zimo Li
> Priority: Major
> Fix For: 1.10.0
>
>
> I am trying to write the result of network IO to a CSV file using Scala and
> the ZIO library. The order of the rows does not matter, so I decided to use a
> concurrency of 8.
> Each thread calls {{{}CSVPrinter.printRecord{}}}, and this caused some rows
> to intersect with others. Eventually, I decided to use a
> [Semaphore|https://zio.dev/version-1.x/datatypes/concurrency/semaphore] to
> fix it.
> A locking mechanism for {{printRecord}} can be implemented just like the
> underlying {{FileWriter}} or {{PrintWriter}}.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)