And second time thank you for your lib!
Done. Function public void fileModified(int wd, String rootPath, String name) runs onModifyTimer(name) every time event occures. It is "on fly solution", but it works. Map<String, Long> fileModifyHashMap = new LinkedHashMap<>(); ... private void onModifyTimer(String relativePath) { Long current = System.currentTimeMillis(); Long prev = fileModifyHashMap.get(relativePath); if(prev != null) { if((current-prev)>300) { System.out.println("(current-prev) = " + (current-prev)); fileModifyHashMap.put(relativePath,...
Done. Function public void fileModified(int wd, String rootPath, String name) runs onModifyTimer(name) every time event occures. Map<String, Long> fileModifyHashMap = new LinkedHashMap<>(); ... private void onModifyTimer(String relativePath) { Long current = System.currentTimeMillis(); Long prev = fileModifyHashMap.get(relativePath); if(prev != null) { if((current-prev)>300) { System.out.println("(current-prev) = " + (current-prev)); fileModifyHashMap.put(relativePath, current); onModify(relativePath);...
Done. Idea: Map<String, Long> fileModifyHashMap = new LinkedHashMap<>(); ... private void onModifyTimer(String relativePath) { Long current = System.currentTimeMillis(); Long prev = fileModifyHashMap.get(relativePath); if(prev != null) { if((current-prev)>300) { System.out.println("(current-prev) = " + (current-prev)); fileModifyHashMap.put(relativePath, current); onModify(relativePath); } } else { fileModifyHashMap.put(relativePath, current); onModify(relativePath); } } private void onModify(String...
Hello! Thank you for this lib! I noticed, that if file is changed, there are several modify events occures for this file. I think it is due to change size, date, lasttime access etc. Every change generate separate event? How can I merge its events to one action? For example, in standard WatchService I use Thread.sleep( 50 ) and just skip events occures at very close time. I only think use LinkedHashSet and store file paths to it, so I del duplicates. But maybe more fine method?
Hello! Thank you for this lib! I noticed, that if file is changed, there are several modify events occures for this file. I think it is due to change size, date, lasttime access etc. Every change generate separate event? How can I merge its events to one action? For example, in standard WatchService I use Thread.sleep( 50 ) and just skip events occures at very close time.
Found on https://github.com/veracrypt/VeraCrypt/issues/813 Close
Fuund on https://github.com/veracrypt/VeraCrypt/issues/813 Close