Java中文件操作的事务模式 [英] Transaction mode for file operations in Java

查看:109
本文介绍了Java中文件操作的事务模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我在这里要解释的内容没有任何意义,所以我想提前道歉。无论如何,我会尝试。

Perhaps what I'm trying to explain here doesn't make any sense, so I'd like to apologize in advance. Anyway, I will try.

我正在尝试从文件读取,执行一些数据库操作并将内容移动到另一个文件。我想知道是否可以在Java中以原子方式执行所有这些操作,因此如果操作列表中出现任何问题,则回滚整个序列并返回起点。

I'm trying to read from a file, perform some database operations and move the content to another file. I was wondering if it is possible to perform all this operations in an atomic way in Java, so if anything goes wrong in the list of actions, rollback the complete sequence and go back to the start point.

先谢谢你的帮助。

推荐答案

看看 Apache Commons Transaction 。它具有以事务方式管理文件的能力。

Take a look at Apache Commons Transaction. It has the capability to manage files transactionally.

归档文章详述了它与文件系统的使用。

An archived article detailed its use with the file system.

这篇关于Java中文件操作的事务模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆