Class WatcherToggle<T>

  • All Implemented Interfaces:
    Watcher<T>

    public class WatcherToggle<T>
    extends Object
    implements Watcher<T>
    A utility class to enable and disable callbacks to a watcher instance.
    • Constructor Detail

      • WatcherToggle

        public WatcherToggle​(Watcher<T> delegate,
                             boolean enabled)
    • Method Detail

      • disable

        public void disable()
      • enable

        public void enable()
      • onClose

        public void onClose​(WatcherException cause)
        Description copied from interface: Watcher
        Invoked when the watcher closes due to an Exception.
        Specified by:
        onClose in interface Watcher<T>
        Parameters:
        cause - What caused the watcher to be closed.
      • onClose

        public void onClose()
        Description copied from interface: Watcher
        Invoked when the watcher is gracefully closed.
        Specified by:
        onClose in interface Watcher<T>