MY Situation
I have a process which does FTP and another process which Emails.
While I am done with FTP I want to email a success notification. So the email process is watching for a new file pr configuration file to come in to a particular directory
The FTP process creates a file appropriate for the email process which is more or less list of emails in a property file.
The problem I am facing is while I create the file and write it. The email process which detects a new file and reads it before or while the file is being written. Therefore it accesses only null parameters. While I can put a sleep on top of Email process it would not work for all cases and it will hinder for other people who have finished files.
What can I use to -create a property file which cannot be read untill it is completely written -or create a property file with a lock which can be unlocked from another process if need be.
What are my choices?
As far as now: - I have tried using apache commons configuration to setProperty it created the same old read/write access problem - I created a property =new property and used store method to create the file. Even then the Email process would read before it is completely
FYI: Email Process had WatchDirectory and reads whenever a new file is created.