Class SynchronousFileWatcher
java.lang.Object
org.apache.nifi.util.file.monitor.SynchronousFileWatcher
Allows the user to configure a
Path
to watch for modifications and periodically poll to check if the file has been modified-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
private final AtomicReference
<SynchronousFileWatcher.StateWrapper> private final UpdateMonitor
private final Path
private final Lock
-
Constructor Summary
ConstructorsConstructorDescriptionSynchronousFileWatcher
(Path path, UpdateMonitor monitor) SynchronousFileWatcher
(Path path, UpdateMonitor monitor, long checkMillis) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the file has been updated according to the configuredUpdateMonitor
and resets the stateprivate boolean
-
Field Details
-
path
-
checkUpdateMillis
private final long checkUpdateMillis -
monitor
-
lastState
-
resourceLock
-
-
Constructor Details
-
SynchronousFileWatcher
-
SynchronousFileWatcher
-
-
Method Details
-
checkAndReset
Checks if the file has been updated according to the configuredUpdateMonitor
and resets the state- Returns:
- true if updated; false if not updated or if not yet time to check
- Throws:
IOException
- if failure occurs checking for changes
-
checkForUpdate
- Throws:
IOException
-