Class AbstractResourceWatcher<Listener>

  • All Implemented Interfaces:
    ResourceWatcher
    Direct Known Subclasses:
    FileWatcher

    public abstract class AbstractResourceWatcher<Listener>
    extends java.lang.Object
    implements ResourceWatcher
    Abstract resource watcher framework, which handles adding and removing listeners and calling resource observer.
    • Constructor Detail

      • AbstractResourceWatcher

        public AbstractResourceWatcher()
    • Method Detail

      • addListener

        public void addListener​(Listener listener)
        Registers new listener
      • remove

        public void remove​(Listener listener)
        Unregisters a listener
      • listeners

        protected java.util.List<Listener> listeners()
        Returns a list of listeners
      • doInit

        protected abstract void doInit()
                                throws java.io.IOException
        Will be called once on initialization
        Throws:
        java.io.IOException
      • doCheckAndNotify

        protected abstract void doCheckAndNotify()
                                          throws java.io.IOException
        Will be called periodically

        Implementing watcher should check resource and notify all listeners().

        Throws:
        java.io.IOException