Results 1 to 4 of 4

Thread: Single connection for Partioned step ?

  1. #1
    Join Date
    Dec 2011
    Posts
    10

    Default 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

  2. #2
    Join Date
    Dec 2011
    Posts
    10

    Default

    Can anybody help me ??

  3. #3
    Join Date
    Nov 2011
    Posts
    23

    Default

    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.

  4. #4
    Join Date
    Dec 2011
    Posts
    10

    Default

    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
  •