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.
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.
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.