Interface ChangeWatcher<T>

  • Type Parameters:
    T - target of this change watcher, such as Path
    All Known Implementing Classes:
    EtcdWatcher, FileSystemWatcher

    public interface ChangeWatcher<T>
    Similar to a PollingStrategy a change watcher is used to identify a change and trigger reload of a ConfigSource. 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.
    • 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 as Path
        listener - listener that handles reloading of the resource being watched
      • stop

        default void stop()
        Stop watching all targets for changes.
      • type

        Class<T> type()
        Target supported by this change watcher.
        Returns:
        type supported