Click to See Complete Forum and Search --> : File Locking for multiple threads and RMI
Relon
August 23rd, 1999, 05:01 PM
I have several threads running in different programs that will might try reading and writing to the same file at the same time. The best solution I could come up with was to write a small RMI semaphore server using the absolute path and file name as the key. Is there a simpler way to do this?? I'm not really even sure if it's necessary.
Thanks in advance,
Scott Moyer
Quicksand Development
DeviPrasad
August 24th, 1999, 10:29 AM
hi,
You can do this by having a separate class that handles all the IO issues of that file. You can make the IO method calls from synchronized methods of your new IO class.
The other method is to use the synchronized keyword over your InputStream/OutputStream object
thanx,
devi prasad m.p.
Keep working hard!!!
Keep climbibg high!!!
DeviPrasad
August 24th, 1999, 10:37 AM
hai,
Hope u had refered my prev answer. Before trying out that please check whether read, write, etc IO methods are already synchronized. If they are already synchronized, u don't have to do all those.
bye,
devi prasad m.p,
Keep working hard!!!
Keep climbibg high!!!
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.