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.
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
For plain Java, you can have a look at
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With