I have many applications writing to my file in concurrent in java.I want to make this operation concurrent and also want my file to preserve order.I have
Thread 1 writing from website 1
Thread 2 writing from website 2
Thread 3 writing from website 3
And i want to preserve order.
How can i do this
Thanks
You can use regular synchronization mechanism. Create file repository that contains references to java.io.File objects. It will expose API like getFile(String path). Every time you want to access file do the following:
Other way to synchronize access to files is: