Hi. I need to access a file for read/write from two different servlets. How can i ensure concurrency ?i.e I dont want the file to be accessed by one servlet while it is being written into by another. Thanks in advance.
posted 15 years ago
A quick suggestion would be to pull out the code that creates or obtains the handle to the file and put it in a separate class as a static method. This way, each servlet can use this code and it can be synchronized to ensure concurrency.