I have a web platform with users who write and read a XML file. How can i block users to write on the XML file while another one is doing it? For security, i don't want 2+ users writing the XML file at the same time...
You need to synchronize the write method. Read up on it here:
http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html
You may want to rethink the design if you have multiple users writing to the same config file. I expect you'll have lots of problems. Can you use a database instead?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.