Is Java 7 WatchService Slow for Anyone Else?

后端 未结 2 1847
后悔当初
后悔当初 2020-12-01 05:18

WatchService looks like a great technology but its been too slow to be useful on the OS X and Linux systems I\'ve tested on. To add insult to injury, it doesn\'t seem to ge

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 05:28

    I have much better response times if I change

    folder.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY);
    

    to

    folder.register(watcher, new WatchEvent.Kind[]{StandardWatchEventKinds.ENTRY_MODIFY}, SensitivityWatchEventModifier.HIGH);
    

提交回复
热议问题