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 Summary
ConstructorsConstructorDescriptionCreate 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 Summary
Modifier 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
- 
FileSystemWatcher
public FileSystemWatcher()Create a newFileSystemWatcherinstance. - 
FileSystemWatcher
Create a newFileSystemWatcherinstance.- Parameters:
 daemon- if a daemon thread used to monitor changespollInterval- the amount of time to wait between checking for changesquietPeriod- the amount of time required after a change has been detected to ensure that updates have completed
 - 
FileSystemWatcher
public FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository) Create a newFileSystemWatcherinstance.- Parameters:
 daemon- if a daemon thread used to monitor changespollInterval- the amount of time to wait between checking for changesquietPeriod- the amount of time required after a change has been detected to ensure that updates have completedsnapshotStateRepository- the snapshot state repository- Since:
 - 2.4.0
 
 
 - 
 - 
Method Details
- 
addListener
Add listener for file change events. Cannot be called after the watcher has beenstarted.- Parameters:
 fileChangeListener- the listener to add
 - 
addSourceDirectories
Add source directories to monitor. Cannot be called after the watcher has beenstarted.- Parameters:
 directories- the directories to monitor
 - 
addSourceDirectory
Add a source directory to monitor. Cannot be called after the watcher has beenstarted.- Parameters:
 directory- the directory to monitor
 - 
setTriggerFilter
Set an optionalFileFilterused to limit the files that trigger a change.- Parameters:
 triggerFilter- a trigger filter or null
 - 
start
public void start()Start monitoring the source directory for changes. - 
stop
public void stop()Stop monitoring the source directories. 
 -