Search code examples
javamultithreadingjsr352

Java Batch Multithreading


I have some JSR-352 batch jobs that run quite well - despite their runtime. Now I am thinking of distributing the work across several threads.

How is this pattern supported by JSR-352?

Edit: Now that I know the keywords to search for I can make out more resources on this problem:

I want to create a partitioned batchlet, and the partitions must be calculated at runtime. The idea is to split the processing of all records into a predefined maximum number of partitions, or a number of partitions with maximum size.


Solution

  • Here is another example of using partitioned chunk processing in JBeret. Partitioned batchlet should be similar in terms of job configuration. But partitioned batchlet is not common compared to partitioned chunk steps, because batchlet is mainly a task-oriented step, which is not easy to split into multiple partitions. So you may want to check if batchlet step is really suitable.

    JBeret project test-apps module contains some examples with partition configuration. For example, cdiScopes tests use batchlet with partitions. Throttle tests use chunk with partitions.

    JBeret test-apps/chunkPartition test module contains a job xml that uses mapper for dynamic partition.