@InterfaceAudience.Private public final class FileChangeWatcher extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FileChangeWatcher.FileChangeWatcherCallback |
| Constructor and Description |
|---|
FileChangeWatcher(Path filePath,
String threadNameSuffix,
Duration pollInterval,
FileChangeWatcher.FileChangeWatcherCallback callback)
Creates a watcher that watches
filePath and invokes callback on
changes. |
| Modifier and Type | Method and Description |
|---|---|
void |
start()
Tells the background thread to start.
|
void |
stop()
Tells the background thread to stop.
|
public FileChangeWatcher(Path filePath, String threadNameSuffix, Duration pollInterval, FileChangeWatcher.FileChangeWatcherCallback callback) throws IOException
filePath and invokes callback on
changes.filePath - the file to watch.callback - the callback to invoke with events. event.kind() will return the
type of event, and event.context() will return the filename
relative to dirPath.IOException - if there is an error creating the WatchService.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.