-
Dec 22nd, 2011, 01:30 AM
#1
Single connection for Partioned step ?
Hi All,
I want single connection get shared between partitioned step which process xml file.
Partition step is reading xml files and inserting data into database. But i found that, new connection is get created for every File processing.
Below are my steps:
1. job have master partition step with resource directory, task executor as SimpleAsyncTaskExecutor.
2. There is xml directory having 6 xml files to process individually. Step is reader,processor and writer defined to read/process/write into database.
3. Before executing job, if connection count=50. After running job,connection count becomes 57 (for 6 files).
clearly for every xml file processing in partition creates New connection.
What should i use to reuse single connection between all XML file processing steps.
Thanks
Tushar
-
Dec 22nd, 2011, 09:46 PM
#2
-
Dec 24th, 2011, 06:58 AM
#3
The main reason for having partitioned step in spring batch is to run each file in its own step context parallely .To Have 6 files run in single database connection,you needs a multiple transaction . To run multiple transactions over a single connection they will just have to be run one at a time so you'll have to queue or stack them and block as the transaction happens. You generally will not be able to run queries in parallel over a single connection(i mean multiple chunk of different files ), so the use of Partition Step becomes defied/Void/useless .hope i am clear.
-
Dec 27th, 2011, 03:22 AM
#4
ohh.right. very well explained. thanks a lot
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
-
Forum Rules