Class FileSystemWatcher
java.lang.Object
org.springframework.boot.devtools.filewatch.FileSystemWatcher
Watches specific directories for file changes.
- Since:
- 1.3.0
- Author:
- Andy Clement, Phillip Webb
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newFileSystemWatcherinstance.FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod) Create a newFileSystemWatcherinstance.FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository) Create a newFileSystemWatcherinstance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddListener(FileChangeListener fileChangeListener) Add listener for file change events.voidaddSourceDirectories(Iterable<File> directories) Add source directories to monitor.voidaddSourceDirectory(File directory) Add a source directory to monitor.voidsetTriggerFilter(FileFilter triggerFilter) Set an optionalFileFilterused to limit the files that trigger a change.voidstart()Start monitoring the source directory for changes.voidstop()Stop monitoring the source directories.
- 
Constructor Details- 
FileSystemWatcherpublic FileSystemWatcher()Create a newFileSystemWatcherinstance.
- 
FileSystemWatcherCreate a newFileSystemWatcherinstance.- Parameters:
- daemon- if a daemon thread used to monitor changes
- pollInterval- the amount of time to wait between checking for changes
- quietPeriod- the amount of time required after a change has been detected to ensure that updates have completed
 
- 
FileSystemWatcherpublic FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository) Create a newFileSystemWatcherinstance.- Parameters:
- daemon- if a daemon thread used to monitor changes
- pollInterval- the amount of time to wait between checking for changes
- quietPeriod- the amount of time required after a change has been detected to ensure that updates have completed
- snapshotStateRepository- the snapshot state repository
- Since:
- 2.4.0
 
 
- 
- 
Method Details- 
addListenerAdd listener for file change events. Cannot be called after the watcher has beenstarted.- Parameters:
- fileChangeListener- the listener to add
 
- 
addSourceDirectoriesAdd source directories to monitor. Cannot be called after the watcher has beenstarted.- Parameters:
- directories- the directories to monitor
 
- 
addSourceDirectoryAdd a source directory to monitor. Cannot be called after the watcher has beenstarted.- Parameters:
- directory- the directory to monitor
 
- 
setTriggerFilterSet an optionalFileFilterused to limit the files that trigger a change.- Parameters:
- triggerFilter- a trigger filter or null
 
- 
startpublic void start()Start monitoring the source directory for changes.
- 
stoppublic void stop()Stop monitoring the source directories.
 
-