Class PathWatcherService

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable, WatcherService, org.springframework.beans.factory.DisposableBean
    Direct Known Subclasses:
    FileWatcherService

    public class PathWatcherService
    extends java.lang.Object
    implements WatcherService, java.lang.Runnable, java.io.Closeable, org.springframework.beans.factory.DisposableBean
    Control watch operations on paths and files as a service.
    Since:
    5.2.0
    • Constructor Summary

      Constructors 
      Constructor Description
      PathWatcherService​(java.io.File watchablePath, java.util.function.Consumer<java.io.File> onModify)  
      PathWatcherService​(java.nio.file.Path watchablePath, java.util.function.Consumer<java.io.File> onCreate, java.util.function.Consumer<java.io.File> onModify, java.util.function.Consumer<java.io.File> onDelete)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close.
      void destroy()  
      void run()  
      void start​(java.lang.String name)
      Start the watch.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathWatcherService

        public PathWatcherService​(java.io.File watchablePath,
                                  java.util.function.Consumer<java.io.File> onModify)
      • PathWatcherService

        public PathWatcherService​(java.nio.file.Path watchablePath,
                                  java.util.function.Consumer<java.io.File> onCreate,
                                  java.util.function.Consumer<java.io.File> onModify,
                                  java.util.function.Consumer<java.io.File> onDelete)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • close

        public void close()
        Description copied from interface: WatcherService
        Close.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface WatcherService
      • start

        public void start​(java.lang.String name)
        Description copied from interface: WatcherService
        Start the watch.
        Specified by:
        start in interface WatcherService
        Parameters:
        name - the name
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean