Spring -batch Process all the records parallelly using threadPoolTaskExecutor

Viewed 34

I am using threadPoolTaskExecutor with below configuration in Spring Batch application.

<bean id="threadPoolTaskExecutor"
        class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
        <property name="corePoolSize" value="10"/>
        <property name="maxPoolSize" value="15"/>
        <property name="queueCapacity" value="30"/>
    </bean>

Also processing records in chunk with commit-interval="20000".

<batch:tasklet  task-executor="threadPoolTaskExecutor">
            <batch:chunk reader="inputItemReader" writer="itemWriter"
                commit-interval="20000" skip-limit="10000">
            </batch:chunk>
</batch:tasklet>

I am processing of file with 200k records, what i am observing is

It starts 4 thread each of picking 20000 records to process. Once all the 4 threads process the records then next again 4 threads will be created to process remaining records. I am not understanding why it is creating only 4 threads and waiting to complete.

I want to process all the records parallelly, .i.e it should create more than 4 threads (may be 10 threads) and process all parallely.

what is missing here?

0 Answers
Related