Package org.forgerock.util
Class DirectoryWatcher.ChangeListener
java.lang.Object
org.forgerock.util.DirectoryWatcher.ChangeListener
- Enclosing class:
- DirectoryWatcher
A change listener for a single directory that can be used to register notification callbacks and to cancel
observing this directory.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels this change listener.onChange
(BiConsumer<Path, WatchEvent.Kind<Path>> consumer) Registers a listener to be notified of change events for this directory.onOverflow
(Runnable action) Registers a callback to be notified when the underlying watch service lost some change events due to overflow.toString()
-
Method Details
-
cancel
public void cancel()Cancels this change listener. -
onChange
Registers a listener to be notified of change events for this directory.- Parameters:
consumer
- the callback that will be given the normalized absolute path of the file that changed and the kind of change event.- Returns:
- this change listener.
-
onOverflow
Registers a callback to be notified when the underlying watch service lost some change events due to overflow.- Parameters:
action
- the action to perform when the watch service loses events due to overflow.- Returns:
- this change listener.
-
toString
-