While implementing a "sFTP --mv--> sFTP" program I use WatchService
from the java.nio
lib to register StandardWatchEventKinds.ENTRY_CREATE
. The use case is, that some device drops a file onto a Server in a DMZ, which I'd like to move to another FTP Server in my Domain.
The file transmission onto the first server can take some moments. How can I safely move the file to the 2nd server, because I don't know when the creation process is complete and the file is able to be moved? Is Entry_create the wrong Event to be listened to?