I am dealing with a file in Java that is used to hold serialized objects. In order to determine if the process that is writing to this file has timed out, I check the lastModified() method on the file and expect it to be updated each time an object is written. On Linux and Mac this works fine, but on Windows, the timestamp is not updated until the FileOutputStream is closed. I've also tried directly updating the timestamp using setLastModified() to no avail. From what I've gleaned from Google, it seems that this is known behavior with files on Windows.
My question is how can I achieve what I want on Windows? I just need to be able to determine when something was serialized. The rub is that the serialization and the monitoring are in different JVMs.
I'd prefer to find a way to keep using the timestamp approach as it works great on all other platforms, but workarounds would also be appreciated.
Thanks