Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any open-source tools or frameworks on transactional file I/O, Java language? [closed]

My project needs RandomAccessFile,and I have made it.But when testing the Mutiple Access,many problems found.It can not make sure the file access security , no ACID semantics.So I need a framework based on RandomAccessFile to solve this problem.

like image 370
xzz Avatar asked Nov 05 '22 11:11

xzz


1 Answers

What exactly are the problems you encountered? Do you need full ACID support, with concurrent transaction isolation, rollback, etc. Or do you "only" need a bit more robustness to deal with some kinds failures? The solution will depend on your requirements.

Here are nevertheless a list of frameworks that tackles the problem of transactional file system.

If your app runs in a Java EE application server, you can have a look at

  • JBoss Transactional File I/O, looks promising.
  • Filera: File resource adapter, but I don't think it's transactional
  • JCA connector: a file system adapter, my own implementation

For plain Java, you can have a look at

  • commons-transactions, but I feel like the project is dead
  • maybe Java Content Repository (JSR-170 and JSR-283), but it's a high-level API

Generally speaking, having transactional file system is complicated. Otherwise you can craft a design yourself to provide some robustness. Here is an answer where I sketch a design that provide usually sufficient robustness. Make sure also you understand how flushing (e.g. FileOutputStream.flush) works with the java File API to increase robustness. If you want full ACID robustness it's almost easier to store the data in a database.

Again, the solution will depend on the exact level of robustness you need. Some problems can be addressed at the design level (locks, flush, etc.), some will require a third-party library to have real transactions.

Related:

  • How to manage transaction for database and file system in Java EE environment?
  • How to bring coordination between file system and database?
  • How to efficiently manage files on a filesystem in Java?
like image 175
ewernli Avatar answered Nov 11 '22 14:11

ewernli