FileLock()
Hello,
I am currently writing a program which requires me to create a locked file, which a user can edit, and then the file be distributed to a/some server/s. We have managed to get this working under windows using the FileLock lock() method. However in Linux, due to the way Linux locks files, if the same .class file is used, multiple locks can be obtained, potentially from different users, on the same file (This could potentially lead to a lost update problem, etc) I have tried creating unnamed new objects from each required class (IE the Server, and the Client) using just new LockingServerTry() and new Client3GUI(); which istself calls new Client2(). This didn't work. Inefficent I know, but thats the way my lecturer wants it. (IE He can run it with and without a GUI)
Does anyone have any ideas how I could solve this problem? Websites are good, as are (small) snippets of code or a java class file name (EG FileChannel, or FileLock) The package it comes from would be useful as well (EG FileChannel and FileLock are java.nio.channels)
If anyone wants my code, then I will post it up here, however it is long (At last count 400 - 500 lines per .java file) and as such if I can avoid it, I will!
I thank you in advance for any help you are able to offer me.
Sincerely
---
David Thorne, Student
UK
__________________
---
David Thorne, Student
UK
|