Announcement Announcement Module
No announcement yet.
Problem with the ThreadPoolTaskExecutor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with the ThreadPoolTaskExecutor

    I have a requirement where in i have to copy the data from one datasource to another datasource. So i have a step which has JdbcCursorItemReader (made read() as synchronized) and JdbcItemWriter which is configured with a different jdbcTemplate and the table name. I am using ThreadPoolTaskExecutor for this step. But i am getting the below exception if i use that.This step works fine without the ThreadPoolTaskExecutor.

    I have written a test case where i insert 100 records into the source table before launching the job and verify those 100 in the target table.

    Is there any issue in JdbcCursorItemReader w.r.t ThreadPoolTaskExecutor?

    java.lang.IndexOutOfBoundsException: Index: 100, Size: 100
    at java.util.ArrayList.RangeCheck(
    at java.util.ArrayList.get(
    at org.springframework.batch.item.database.JdbcCursor ItemReader$
    at org.springframework.batch.item.database.JdbcCursor
    at d(
    at org.springframework.batch.core.step.item.BatchList enerFactoryHelper$
    at org.springframework.batch.core.step.item.SimpleIte mHandler.doRead(
    at org.springframework.batch.core.step.item.ItemSkipP va:141)
    at org.springframework.batch.core.step.item.SimpleIte mHandler.handle(
    at org.springframework.batch.core.step.item.ItemOrien tedStep$2.doInIteration(
    at plate.getNextResult(
    at plate.executeInternal(
    at plate.iterate(
    at org.springframework.batch.core.step.item.ItemOrien tedStep.processChunk(
    at org.springframework.batch.core.step.item.ItemOrien tedStep$1.doInIteration(
    at torRepeatTemplate$
    at java.util.concurrent.ThreadPoolExecutor$ Task(
    at java.util.concurrent.ThreadPoolExecutor$ (

  • #2
    Is there any issue in JdbcCursorItemReader w.r.t ThreadPoolTaskExecutor?
    Yes, the issue is JdbcCursorItemReader is not thread-safe, so it doesn't work when you inject ThreadPoolExecutor i.e. chunks are processed concurrently.
    Last edited by robert.kasanicky; Apr 14th, 2008, 07:43 AM. Reason: typos