Skip to main content

[jsr352-public] Is ItemWriter called in case of empty output data list?

  • From: Cheng Fang < >
  • To:
  • Subject: [jsr352-public] Is ItemWriter called in case of empty output data list?
  • Date: Wed, 26 Feb 2014 15:14:04 -0500

During a chunk processing, the output data list for a chunk can be empty. This can happen if all of the data read so far have been filtered out by the ItemProcessor, resulting in an empty output list. In this case, should the batch runtime still call ItemWriter and associated ItemWriteListeners?

An empty output can also happen when the ItemReader read 0 items. For example, given 30 items, and item-count of 10, the first 3 chunks would deplete all input and the 4th chunk reads 0. When the 4th chunk is committed, should the ItemWriter.writeItems method be called?

Some tck tests seem to expect ItemWriter not called:

ChunkTests.testChunkDefaultItemCount
ChunkTests.testChunkNoProcessorDefined
ParallelExecutionTests.testPartitionedCollectorAnalyzerReducerChunkRestartItemCount10

ChunkTests line 484 expects a job exit status "buffer size = 10", which is set by the writer in chunk 1, 2 &3, but if it is invoked for the 4th chunk (empty chunk), the job exit status would be "buffer size = 0".

What do you think?

Thanks,
Cheng


[jsr352-public] Is ItemWriter called in case of empty output data list?

Cheng Fang 02/26/2014

[jsr352-public] Re: Is ItemWriter called in case of empty output data list?

Arun Gupta 02/26/2014

[jsr352-public] Re: Is ItemWriter called in case of empty output data list?

Michael Minella 02/26/2014

[jsr352-public] Re: Is ItemWriter called in case of empty output data list?

Cheng Fang 02/27/2014

[jsr352-public] Re: Is ItemWriter called in case of empty output data list?

Scott Kurz 02/28/2014
 
 
Close
loading
Please Confirm
Close