'Multiple threads problem in Spring batch when using the StaxEventItemReader

I want to speed up saving data to the database so I chose to use the Multithreading technique with SpringBatch, the first time the input is a csv file so I used the FlatFileItemReader and got better performance using ThreadPoolTaskExecutor. The second time I wanted to read this data from an xml file and save it to the database, so I used the StaxEventItemReader, in this case I could not use the multithreading technique and I got errors like: "Error while reading from event reader" . I don't know what the problem is exactly but I guess StaxEventItemReader can't be used in case of using threads . there another Xml file reader I can use that allows me to use multiple threads? ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source