Re: File Read in 2 JVM



Chris Uppal wrote:
kingpin+nntp@xxxxxxxxxxxxxxx wrote:

Three possible solutions:

0. Have the reader lock the file so that no other process can write to
it. If you can't get the lock, then it means another process is
writing to it.

1. Have the writer create a secondary status file, which is deleted
once the process has been completed. The java.io.File.deleteOnExit()
method can make this easier.

2. Have the writer create the file with a different name/extension, and
then rename it after closing it.

...also...

3. Have the writer write a unique end-marker to the output file.

That's a very good suggestion, as long as there's absolutely no
potential for data being written to the file to be identical to the
end-marker character sequence.

.



Relevant Pages

  • Re: File Read in 2 JVM
    ... Have the reader lock the file so that no other process can write to ... Have the writer create a secondary status file, ... Have the writer write a unique end-marker to the output file. ...
    (comp.lang.java.programmer)
  • Wanted: Read many, Write Exclusive Lock
    ... Does anyone have the source code for a single writer, mutliple ...
    (microsoft.public.win32.programmer.kernel)