Results 1 to 2 of 2

Thread: instances of item reader/writer

  1. #1

    Default instances of item reader/writer

    I have following code:
    Code:
    <batch:step id="bench">
    		<batch:tasklet task-executor="asyncExecutor" throttle-limit="8">
    			<batch:chunk reader="hadoopreader" commit-interval="100"
    				writer="hadoopwriter" cache-capacity="100"
    				processor-transactional="false" processor="solrbench">
    			</batch:chunk>
    		</batch:tasklet>
    </batch:step>
    how many instances of item reader, writer, processor are created? 8 or just one reused by multiple threads because "hadoopreader" bean is scope="step"? If i want multiple instances, will scope="prototype" on itemprocessor help?

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    You'll get one instance of the ItemReader/ItemProcessor/ItemWriter. Spring Batch does not create new instances per thread. Using prototype won't change that either. What are you attempting to accomplish?
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

Posting Permissions

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