title: How to process rows of a CSV file using Groovy/GPars most efficiently?
body: <p>The question is a simple one and I am surprised it did not pop up immediately when I searched for it. </p>
  
  <p>I have a CSV file, a potentially really large one, that needs to be processed. Each line should be handed to a processor until all rows are processed. For reading the CSV file, I'll be using OpenCSV which essentially provides a readNext() method which gives me the next row. If no more rows are available, all processors should terminate. </p>
  
  <p>For this I created a really simple groovy script, defined a synchronous readNext() method (as the reading of the next line is not really time consuming) and then created a few threads that read the next line and process it. It works fine, but...</p>
  
  <p>Shouldn't there be a built-in solution that I could just use? It's not the gpars collection processing, because that always assumes there is an existing collection in memory. Instead, I cannot afford to read it all into memory and then process it, it  would lead to outofmemory exceptions. </p>
  
  <p>So.... anyone having a nice template for processing a CSV file "line by line" using a couple of worker threads?</p>