Implementing the mass indexing functionality using the standardized batching API allows you to use the existing tools of your runtime environment for starting/stopping and monitoring the status of the indexing process. E.g. in WildFly you can use the CLI to do so.

Also JSR 352 provides a way to restart specific job runs. This is very useful if re-indexing of an entity type failed mid-way, for instance due to connectivity issues with the database. Once the problem is solved, the batch job will continue where it left off, not processing again those items already processed successfully.

As JSR 352 defines common concepts of batch-oriented applications such as item readers, processors and writers, the job architecture and workflow is very easy to follow. In JSR 352, the workflow is written in an XML file (the "job XML"), which is used to specify a job, its steps and directs their execution. So you can understand the process without jumping into the code.

<job id = " massIndex " > <step id = " beforeChunk " next = " produceLuceneDoc " > <batchlet ref = " beforeChunkBatchlet " /> </step> <step id = " produceLuceneDoc " next = " afterChunk " > <chunk checkpoint-policy = " custom " > <reader ref = " entityReader " /> <processor ref = " luceneDocProducer " /> <writer ref = " luceneDocWriter " /> <checkpoint-algorithm ref = " checkpointAlgorithm " /> </chunk> ... </step> <step id = " afterChunk " > <batchlet ref = " afterChunkBatchlet " /> </step> </job>