Class AbstractNIO2Watcher

  • All Implemented Interfaces:
    Watcher
    Direct Known Subclasses:
    TreeWatcherNIO, WatcherNIO2

    public abstract class AbstractNIO2Watcher
    extends Object
    implements Watcher
    NIO2 watcher implementation for systems which support ExtendedWatchEventModifier.FILE_TREE

    Java 7 (NIO2) watch a directory (or tree) for changes to files.

    By http://docs.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java

    Author:
    Jiri Bubnik, alpapad@gmail.com
    • Method Detail

      • addEventListener

        public void addEventListener​(ClassLoader classLoader,
                                     URI pathPrefix,
                                     WatchEventListener listener)
        Description copied from interface: Watcher
        Register listeners on an event.
        Specified by:
        addEventListener in interface Watcher
        Parameters:
        classLoader - the classloader to which this path is associated. May be null, but then this listener will never be disassociated (even if application is undeployed)
        pathPrefix - where to listen
        listener - the listener
      • addEventListener

        public void addEventListener​(ClassLoader classLoader,
                                     URL pathPrefix,
                                     WatchEventListener listener)
        Description copied from interface: Watcher
        Register listeners on an event.
        Specified by:
        addEventListener in interface Watcher
        Parameters:
        classLoader - the classloader to which this path is associated. May be null, but then this listener will never be disassociated (even if application is undeployed)
        pathPrefix - where to listen
        listener - the listener
      • closeClassLoader

        public void closeClassLoader​(ClassLoader classLoader)
        Remove all transformers registered with a classloader
        Specified by:
        closeClassLoader in interface Watcher
        Parameters:
        classLoader -
      • run

        public void run()
        Description copied from interface: Watcher
        Run the watcher agent thread.
        Specified by:
        run in interface Watcher
      • stop

        public void stop()
        Description copied from interface: Watcher
        Stop the watcher agent thread.
        Specified by:
        stop in interface Watcher