Web启动应用程序:并发问题 [英] Web Start Application: Concurrency Issue

查看:116
本文介绍了Web启动应用程序:并发问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Part-2:Web Start应用程序:并发问题




$ b b

我在Java中开发了一个GUI工具,它在MS Excel上执行一些操作(例如插入行,检索行,更新行...)。我在这个工具中既没有使用线程编程也没有使用任何锁定机制。

I have developed a GUI tool in Java which does some operation (such as insert row, retrieve row, update row...) on MS Excel. I have neither used thread programming and nor any locking mechanism in this tool.

这个工具被部署为windows exe,现在我已经部署为Web Start Application。
许多人在同一时间访问此工具,并对excel文件(所有人中的共享资源)同时执行操作。

This tool was deployed as windows exe and now I have deployed as Web Start Application. Many people access this tool at the sametime and do operation on that excel file (a shared resource among all people) simultaneusly.

最近这个工具破坏了excel文件,因为两个人在同一时间写excel文件(我从日志中的时间戳知道)。

Recently this tool currupted the excel file because two people were writing on excel file at the same time (I got to know from the timestamp in the logs).

一个人正在更新一个记录,另一个人正在插入一个新记录。两个操作几乎同时发生在同一个excel文件上。现在我认为共享的excel文件损坏的bcoz并发问题。

One person was updating some record and another person was inserting a new record. Both operations happened almost at the sametime on the same excel file. Now I think that the shared excel file was corrupted bcoz concurrency issues.

你能帮我在这种情况下我想做什么吗?我如何解决这个问题?是否有简单的方法来解决这个问题?

Can you please help me what I suppose to do in this case? How I fix this problem? Is there a simple way to fix this issue?

很多谢谢,
Rahul

Many Thanks, Rahul

推荐答案

您可能想了解文件锁。以下是一个让您快速入门的示例。

You might want to learn about file locks. Here is an example to get you started quickly.


http://www.exampledepot.com/egs/java.nio/SetFileLock.html

这篇关于Web启动应用程序:并发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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