public class RestartableFileSystemWatcher extends Object implements FileWatcher
startWatching() call.
When delegate will be stopped all registered resources will be closed and delegate delegate will be stopped.
Described pattern allows to perform repeatable startWatching/stopWatching cycle for pre-configured set of files.SILENT_WATCHER| Constructor and Description |
|---|
RestartableFileSystemWatcher(FileWatcher delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFileWatchEventListener(FileWatchEventListener listener)
Register listener to receive updates about registered resources.
|
void |
close() |
void |
removeFileWatchEventListener(FileWatchEventListener listener)
Remove listener from a list of updates receivers.
|
void |
startWatching()
Start monitoring of registered directories.
|
void |
stopWatching()
Stop monitoring of registered directories
|
WatchedResource |
watch(File file)
Register provided directory in list of resources that we would like to watch and receive status modification
updates
|
public RestartableFileSystemWatcher(FileWatcher delegate)
public WatchedResource watch(File file) throws IOException
FileWatcherwatch in interface FileWatcherfile - directory to be monitored for updatesIOExceptionpublic void addFileWatchEventListener(FileWatchEventListener listener)
FileWatcheraddFileWatchEventListener in interface FileWatcherlistener - listener to registerpublic void removeFileWatchEventListener(FileWatchEventListener listener)
FileWatcherremoveFileWatchEventListener in interface FileWatcherlistener - listener to removepublic void stopWatching()
FileWatcherstopWatching in interface FileWatcherpublic void startWatching()
throws InterruptedException
FileWatcherFileWatcher.stopWatching().startWatching in interface FileWatcherInterruptedException - when interrupted while waiting for update notification to comepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.