Jan 11th, 2012, 06:47 AM
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.
Jan 11th, 2012, 11:52 AM
I found these links when Googling for "standalone JTA Transaction Manager"
<sorry for the JBoss link, but hell I was a JBoss employee for a couple years.>
All point to many standalone JTA TX Managers.
Jan 11th, 2012, 12:00 PM
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
Tags for this Thread