-
- Type Parameters:
T- target of this change watcher, such asPath
- All Known Implementing Classes:
EtcdWatcher,FileSystemWatcher
public interface ChangeWatcher<T>Similar to aPollingStrategya change watcher is used to identify a change and trigger reload of aConfigSource. Where a polling strategy provides polling events to check for changes, change watcher is capable of identifying a change in the underlying target using other means.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceChangeWatcher.ChangeEvent<T>A change event, carrying the target, type of change and time of change.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidstart(T target, Consumer<ChangeWatcher.ChangeEvent<T>> listener)Start watching a target for changes.default voidstop()Stop watching all targets for changes.Class<T>type()Target supported by this change watcher.
-
-
-
Method Detail
-
start
void start(T target, Consumer<ChangeWatcher.ChangeEvent<T>> listener)
Start watching a target for changes. If a change happens, notify the listener.- Parameters:
target- target of this watcher, such asPathlistener- listener that handles reloading of the resource being watched
-
stop
default void stop()
Stop watching all targets for changes.
-
-