开发者

FileMonitor filechanges combine signals (aggregate them)

开发者 https://www.devze.com 2023-03-20 03:43 出处:网络
long time visitor, my first question. I\'m more looking for ideas to my problem than a specific java question.

long time visitor, my first question.

I'm more looking for ideas to my problem than a specific java question.

I have a file and/or directory that I need to pass on (rsync) to one or more remote hosts.

I'm using Apache's FileAlterationMonitor polling every 5 seconds.

When the many files are changed in a directory, i'd like to start rsync but only when I know all the files are done. Since FileMon is polling every 5 seconds, I get multiple requests when my input dir is being changed more than 5 minutes.

You'd think I'd just increase the polling, that still leaves me with 2 signals if my triggers happens 开发者_C百科to be in a middle of a change.

How can I aggregate these signals so that I process the directory once.

(if curious about the process and why it needs to happen only once is because I'm doing a deep md5 checksum of the directory and rsyncing that file too. if in the middle of transfer, my md5checksum will be wrong. )

Hope I clarified my problem well, I'm open to other ideas of doing this. Is there another filemonitor that can combine multiple changes say in the last five minutes into one?

Thanks,

Dan

0

精彩评论

暂无评论...
验证码 换一张
取 消