Results 1 to 3 of 3

Thread: MultiThreading within Reader!!!

  1. #1
    Join Date
    May 2009
    Posts
    2

    Post MultiThreading within Reader!!!

    I am building an Spring Batch application (v2.0.0) to process multiple files(i.e.task) parallely. Each file may have hundreds of lines of records that need to be processed individually. Currently I am able to create threads(Slaves) for each file (i.e. 10 threads for 10 files) by implementing the Partitioner class(partition method) using ThreadPoolTaskExecutor. Creating one Thread per File (i.e. task) seems to a feature of Spring Batch. I have used the partitionJob.xml example from spring batch samples for reference.

    But I want to process a individual file with 50 threads. Is there a way to create the additional threads without being dependent on the number of files (or tasks)?

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    Have you looked at the scalability section in teh user guide? It gives a few the options, including the ones that you mention. If you read from a file in multiple threads you cannot restart the step if it fails (so you have to set it restartable="false" manually and switch off the state saving in the reader).

  3. #3
    Join Date
    May 2009
    Posts
    2

    Default

    Yes. After reading the notes, I guess we will need to use a middleware to achieve this or tweak wit. Also another option that i came across the net, was using the Java concurrent API from within a reader class, although it has some disadvantages in case of Job failures. This link http://www.appliweb.net/index.php/blog/viewpost/78 has a good example on implementing it.

    Thanks Dave for referring to the documentation section.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •