Leon Rosenberg wrote:

On 3/20/06, David Kerber <[EMAIL PROTECTED]> wrote:
I have a situation where my java-Tomcat application will be writing
lines of data one at a time (but quickly and lots of them, eventually
approx 2 million  lines per day, though only about 500k right now)  to a
disk file, and another, Delphi, appication will be reading and
processing those lines, one line at a time.  I have done some reading
about the Synchronized keyword and I *think* I understand how it
interacts with other java apps,

It doesn't interact with other java applications. Only with other
Threads in the same VM. That of course depends on your definition of
the application.
That's actually what I meant, but didn't word it very well.

but can't tell if that extends to
applications running elsewhere in the OS (Windows in this case).

No.

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 Delphi
app does not need to write to the file, only read from it.

This is OS dependent. If the OS allows multiple reads/write to a file,
it would be no problem. If I have tomcat in one shell under windows
and tail the logfiles in another - it works, so why shouldn't your
application work too. I think (<speculation>) that you can open files
under windows in exclusive and non-exclusive mode, as long as you use
the non-exclusive mode, you'll have no problems. IMHO Java uses the
non-exclusive mode. (</speculation>). My guess is, that your scenario
will work without problems, at least as long as your writer is faster
than your reader, or your reader can handle temporarly out-of-bytes
:-)
It already does that ok. My java version is actually a port of different Delphi app which is having trouble scaling to the levels we need. With more than 60 or so sites sending data every so often, it's choking and silently dying every so often.

Thanks!
Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to