Caldarale, Charles R wrote:
From: David Kerber [mailto:[EMAIL PROTECTED]
Subject: How does Synchronized code interact with other applications
This has nothing to do with Tomcat.
I suspected that, but wasn't sure; that's why I mentioned it.
If I use a Synchronized block around my code that does the
writing to disk, will the Delphi app (assuming competent
programmers) be able to monitor and read that file without
me closing it after each write?
The synchronized attribute and statement only operate within a given
JVM. If all your apps are running in the same JVM (obviously not the
case here), synchronized will be effective.
Ok. So if I were to port the Delphi app to java and run it as another
thread in my app, I would be ok there...
The answer to your question depends largely on the OS you're using
(which you didn't tell us). It's the filesystem you're using that
determines whether or not it's safe for one process to read from a file
that another is writing at the same time.
The OS is Windows XP or 2000.
Depending on the OS, the Delphi app may or may not have to reopen the
file to detect that it's been extended, and will have to handle partial
lines. The Java app shouldn't have to open and close each time, but may
have to use FileOutputStream.getFD().sync() to insure the data is
actually written out in a timely fashion.
Does fileWriter.flush() do almost the same thing? I'm already doing that...
Thanks!
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]