Java 文件损坏问题
我有一个java应用程序正在执行大量文件操作。对于每个文件处理(任务),我将打开一个 log4j 文件来写入任务日志。在每项任务中,我打开一个文件并进行一些操作并写入三个新文件。任务是并行运行的。现在,每隔两周或三周我的任务日志文件就会随机写入数据文件(并非总是如此,数据和日志会混合写入新的数据文件)。
我们检查了代码,没有发现任何同步问题或 FileDescriptor 重用。
操作系统:AIX 6.1.6.3 JAVA:IBM JAVA 1.5 SR12 FP1 架构:Power 6; 8 芯,SMT 开启 存储:SAN
谢谢 尼凯什·PL
I have a java application which is doing a lot of file operations. For each file processing (task) I will open one log4j file for writing the task log. In each task I am opening one file and doing some manipulation and writing into a three new files. Tasks are running in parallel. Now Randomly once in two weeks or three weeks my task log files are going into data file (not completely always, data and logs are writing in mix into the new data files) .
We have reviewed the code, and are not able to find any synchronization issue or FileDescriptor reuse.
OS : AIX 6.1.6.3
JAVA : IBM JAVA 1.5 SR12 FP1
Architecture : Power 6; 8 core with SMT on
Storage : SAN
Thanks
Nikesh PL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否确保在 try/finally 块中flush() 然后 close() 您的文件输入流(或文件读取器)?
Did you make sure you flush() then close() your files input streams (or files readers) in a try/finally block?