Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement Long running distributed transaction in j2ee

I want to move records from one database to another which are on different machines. the records should be removed from first database and inserted to second database atomically.

can we use xa ? i believe xa uses 2 phase commit algorithm which requires the blocking locks on the resources

the target database is a EIS database, so it should be locked for minimum time.

like image 260
Sumeet Jindal Avatar asked Nov 13 '22 13:11

Sumeet Jindal


1 Answers

XA is indeed a 2 phase commit blocking protocol, but in my case there are only two entities involed with the first entity being very fast. so 2PC will work efficiently for me.

for a more general scenario 3 phase commit can be used. it's a non-blocking protocol. though dont' seems to have any java specifications.

also came across BTP and http://jotm.objectweb.org/jotm-btp.html not sure how easily it can fused with JDBC adapter.

like image 60
Sumeet Jindal Avatar answered Nov 16 '22 02:11

Sumeet Jindal