amhicraig
asked on
file writing to disc in a multiuser enviornment.
I have to generate a file x through a method.Based on the data input to the method the files contents will vary.How will i do this if there are 100 users all using the system at the same time - in such a scenario when user a is viewing the file the file will be modified by user b which is not desirable.Pl. advise.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
either synchronized keyword
for example
Class x{
File f = new File(...);
....
}
synchronized(f){
// read , write .. do stuff - single user, single thread
}
or use java.util.concurrent (for example single Semaphore)