I am working on a small Java application (Java 1.6, Solaris) that will use multiple background threads to control a series of text files for output strings that match a specific regular expression pattern and then use those strings. I have one stream per file; they write the lines of interest to the queue, and another background thread simply controls the queue to collect all the lines of interest in the entire collection of monitored files.
One of the problems that I encounter is when one of the files that I control opens again. Many of the applications that create files that I control simply restart their log file when they restart; they do not add to what is already there.
I need my Java application to detect that the file has been reopened and reloaded after the file.
How can i do this?
source
share