Open diptesh2007 opened 6 years ago
This library only takes into consideration what the implementation of com.github.drapostolos.rdp4j.spi.PolledDirectory.listFiles()
returns. It does not know if the entire file has been written or not.
In other words: it is up to the com.github.drapostolos.rdp4j.spi.PolledDirectory.listFiles()
implementation to check for this (For example ignore files that are not fully written yet).
Another approach could be to use a combination of these callbacks:
fileAdded(FileAddedEvent event)
fileModified(FileModifiedEvent event)
afterPollingCycle(AfterPollingCycleEvent event)
Assuming the poll cycle event flow would be like this:
cycle 1) FileAddedEvent (Assuming large file not fully written yet )
cycle 2...N) FileModifiedEvent (this event should be repeated consecutively for each pollcycle until file is fully written)
Then check in afterPollingCycle
until you get a pollCycle without a FileModifiedEvent
. then file should be fully written. Of course this depends on how long your polling interval is.
Can you please describe the timing of the poll? Does it detects the file as soon as the file is found at the watching directory or it detects the file after the entire file is written in the watching directory? Is there any mechanism to do so?