Open svilenvul opened 7 years ago
Ahh and something else has to be taken into consideration. With this approach the classes that extend AbstractWatchService would have to manually process the folder CREATE event and call the super class method to register the directory.
Since we meanwhile had some refactorings of AbstractWatchService - is this still an issue that should be addressed?
The current implementation of the AbstractWatchService has an option to watch sub directories, but not to register them after service initalization.
A workaround is made in the FolderObserver by calling initializeWatchService(), when a configuration change is detected. The drawback is that each time when we have to register a new directory WatchService close() method is being called.
I think it will make sense if we divide the code in the AbstractWatchService initializeWatchService() into two protected methods:
This will make possible for the classes that extend AbstractWatchService (including FolderObserver and maybe the new coming FileSystemFirmwareProvider ) to register new directories without closing the watch service and reinitializing it.
If you agree with this change I can create a PR for it.