Interface ChangeNotifier<T>

  • Type Parameters:
    T - The records type
    All Known Subinterfaces:
    ChangeNotifierFactory.RunnableChangeNotifier<T>

    public interface ChangeNotifier<T>
    A change notifier represents a watched lookup from a DnsSrvWatcher.

    The records can be of any type. Usually something that directly reflects what your application will use the records for.

    A ChangeNotifier.Listener can be attached to listen to change events on the watched set of records.

    • Method Detail

      • current

        Set<T> current()
        Get the current set of records.
        Returns:
        The current set of records
      • setListener

        void setListener​(ChangeNotifier.Listener<T> listener,
                         boolean fire)
        Set a listener to be called when the set of records change.

        One one listener can be added. Multiple calls to this method is an error.

        Parameters:
        listener - The listener to set
        fire - Fire the notification event immediately. Can be used to ensure that no updates are missed when setting the listener
        Throws:
        IllegalStateException - if called more than once