Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an open-source solution to XA-transactional file access in Java?

Is it possible to make XA-transactional access to the file system in Java? I want to manipulate files within the boundaries of a transaction and my transaction must participate in a distributed transaction via JTA (so I guess the file system needs to be accesses as a XAResource). I don't need support for fine-grained read/write file access; treating each file as a record is good enough for my needs.

Does anybody know an open-source project that already does this? I don't feel like implementing this mess just to find out that it's already been done...

I heard some rumors that JBoss Transcations will add support for this (see for example this discussion) but couldn't find an official statement about this.

By the way, if you need transactional file access but don't require the transaction to participate in a 2-phase commit I recommend you have a look at Apache Commons Transaction

A nice article about the complexities involved can be found in here.

like image 848
Ori Avatar asked May 21 '09 10:05

Ori


People also ask

What is XA transaction Java?

XA is a two-phase commit protocol that is natively supported by many databases and transaction monitors. It ensures data integrity by coordinating single transactions accessing multiple relational databases.

What is transactional file system?

A transactional file system wherein multiple file system operations may be performed as a transaction. An application specifies that file system-related operations should be handled in a transaction, and the application is given a file handle associated with a transaction context.

Which of the following is the feature of Jboss JTA?

The JTA is a high-level application interface that allows a transactional application to demarcate transaction boundaries, and also contains a mapping of the X/Open XA protocol.


2 Answers

Recently I solved exactly the same problem. Finally I used Bitronix with XADisk.

You can find more details in my blog post: JTA transaction manager – Atomikos or Bitronix?

like image 39
gargii Avatar answered Sep 20 '22 08:09

gargii


XADisk can get you what you are looking for. It's free and open source.

like image 196
nitin Avatar answered Sep 21 '22 08:09

nitin