How to implement Long-Term Distributed Transaction in j2ee

I want to move records from one database to another that are on different machines. records must be deleted from the first database and inserted into the second database atomically.

can i use xa? I believe xa uses a 2-phase commit algorithm that requires locking resource locks

The target database is an EIS database, so it should be locked for the minimum amount of time.

+5
source share
2 answers

XA really is a 2-phase commit locking protocol, but in my case there are only two objects that are related to the fact that the first entity is very fast. so 2PC will work efficiently for me.

for a more general scenario, a 3-phase latch can be used. This is a non-blocking protocol. although dont 'seems to have java specifications.

also stumbled upon BTP and http://jotm.objectweb.org/jotm-btp.html is not sure how easily it can connect to the JDBC adapter.

+1
source

XA has nothing to do with the locking mechanism. It simply ensures that ACIDity is preserved even if you update two separate transactional resources. Your usecase only updates one if I understand correctly, so XA is not required here.

0

All Articles