Re: File Read in 2 JVM



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.

-- chris



.



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, ... That's a very good suggestion, as long as there's absolutely no ... end-marker character sequence. ...
    (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)