Announcement Announcement Module
Collapse
No announcement yet.
One transaction per multiple threads Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • One transaction per multiple threads

    The problem is as follows:
    I need to start "global" transaction in certain "main" thread.
    Then a few "child" threads started in "main" thread and all of these threads share that "global" transaction.
    Main thread waits until each of child thread finishes and then commits (or rollbacks) the changes made in the child threads.

    Unfortunately neither the task can be simplified and made single threaded nor the specific changes can be made in data schema, e.g. adding 'validity' flags to the tables the mentioned threads operating with.

    I guess it's possible in JTA as the spec says "Multiple threads may concurrently be associated with the same global transaction." - JTA 1.1, section 3.2, page 13.

    My application is deployed on a pretty ordinary servlet container (Jetty) and one transaction manager is used - DataSourceTransactionManager.
    DB is Oracle (and AFAIK it does support nested transaction so the "shared" transaction is possible, at least theoretically).

    Could you please point me to the right direction?
    Any help is greatly appreciated.

  • #2
    I found these links when Googling for "standalone JTA Transaction Manager"

    http://lightweightyes.blogspot.com/2...-managers.html

    <sorry for the JBoss link, but hell I was a JBoss employee for a couple years.>
    https://community.jboss.org/wiki/How...sactionManager

    http://stackoverflow.com/questions/2...-for-hibernate

    All point to many standalone JTA TX Managers.

    Good Luck

    Mark

    Comment


    • #3
      Thanks a lot!

      After digging deeper at this question I decided to refuse this architecture and rather prepare to face potential performance problem and if facing one deal with it in another, less complicated way being with the pretty standard approach to transactions management

      Comment

      Working...
      X