Package org.elasticsearch.watcher
Class FileWatcher
- java.lang.Object
-
- org.elasticsearch.watcher.AbstractResourceWatcher<FileChangesListener>
-
- org.elasticsearch.watcher.FileWatcher
-
- All Implemented Interfaces:
ResourceWatcher
public class FileWatcher extends AbstractResourceWatcher<FileChangesListener>
File resources watcher The file watcher checks directory and all its subdirectories for file changes and notifies its listeners accordingly
-
-
Constructor Summary
Constructors Constructor Description FileWatcher(java.nio.file.Path file)
Creates new file watcher on the given directory
-
Method Summary
Modifier and Type Method Description void
clearState()
Clears any state with the FileWatcher, making all files show up as newprotected void
doCheckAndNotify()
Will be called periodicallyprotected void
doInit()
Will be called once on initialization-
Methods inherited from class org.elasticsearch.watcher.AbstractResourceWatcher
addListener, checkAndNotify, init, listeners, remove
-
-
-
-
Method Detail
-
clearState
public void clearState()
Clears any state with the FileWatcher, making all files show up as new
-
doInit
protected void doInit() throws java.io.IOException
Description copied from class:AbstractResourceWatcher
Will be called once on initialization- Specified by:
doInit
in classAbstractResourceWatcher<FileChangesListener>
- Throws:
java.io.IOException
-
doCheckAndNotify
protected void doCheckAndNotify() throws java.io.IOException
Description copied from class:AbstractResourceWatcher
Will be called periodicallyImplementing watcher should check resource and notify all
AbstractResourceWatcher.listeners()
.- Specified by:
doCheckAndNotify
in classAbstractResourceWatcher<FileChangesListener>
- Throws:
java.io.IOException
-
-