I am watching a directory for incoming files (using FileAlterationObserver from apache commons).
class Example implements FileAlterationListener {
public
I don't think you can achieve what you want unless you have some file system constraints and guarantees. For example, what if you have the following scenario :
If file X cannot be updated after it's written out, you can have a thread of execution that calculates the elapsed time from the last update to now, and after some interval decides that the file write is complete. But even this has issues. If the file system is hung, and the write does not occur for some time, you could erroneously conclude that the file is finished writing out.