|
|
Problem with the ThreadPoolTaskExecutor
Hi, 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(ArrayList.java:546)
at java.util.ArrayList.get(ArrayList.java:321)
at org..batch.item.database.JdbcCursor ItemReader$BufferredResultSetReader.read(JdbcCurso rItemReader.java:480)
at org..batch.item.database.JdbcCursor ItemReader.read(JdbcCursorItemReader.java:183)
at com.om.dh.batch.core.BatchJdbcCursorItemReader.rea d(BatchJdbcCursorItemReader.java:16)
at org..batch.item.support.DelegatingI temReader.read(DelegatingItemReader.java:60)
at org..batch.core.step.item.BatchList enerFactoryHelper$1.read(BatchListenerFactoryHelpe r.java:68)
at org..batch.core.step.item.SimpleIte mHandler.doRead(SimpleItemHandler.java:83)
at org..batch.core.step.item.ItemSkipP olicyItemHandler.read(ItemSkipPolicyItemHandler.ja va:141)
at org..batch.core.step.item.SimpleIte mHandler.handle(SimpleItemHandler.java:62)
at org..batch.core.step.item.ItemOrien tedStep$2.doInIteration(ItemOrientedStep.java:495)
at org..batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:346)
at org..batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:212)
at org..batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
at org..batch.core.step.item.ItemOrien tedStep.processChunk(ItemOrientedStep.java:488)
at org..batch.core.step.item.ItemOrien tedStep$1.doInIteration(ItemOrientedStep.java:288)
at org..batch.repeat.support.TaskExecu torRepeatTemplate$ExecutingRunnable.run(TaskExecut orRepeatTemplate.java:215)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
thanks,
Ram
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. |
|