public class DefaultFileSystemWatcher extends Object implements FileWatcher
WatchService.
Safe to be used from multiple threadsSILENT_WATCHER| Constructor and Description |
|---|
DefaultFileSystemWatcher(WatchService watchService) |
| 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 DefaultFileSystemWatcher(WatchService watchService)
public WatchedResource watch(File file) throws IOException
FileWatcherwatch in interface FileWatcherfile - directory to be monitored for updatesIOExceptionpublic void startWatching()
throws InterruptedException
FileWatcherFileWatcher.stopWatching().startWatching in interface FileWatcherInterruptedException - when interrupted while waiting for update notification to comepublic void stopWatching()
FileWatcherstopWatching in interface FileWatcherpublic void addFileWatchEventListener(FileWatchEventListener listener)
FileWatcheraddFileWatchEventListener in interface FileWatcherlistener - listener to registerpublic void removeFileWatchEventListener(FileWatchEventListener listener)
FileWatcherremoveFileWatchEventListener in interface FileWatcherlistener - listener to removepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2002–2018 The Neo4j Graph Database Project. All rights reserved.