- java.lang.Object
-
- io.helidon.config.MutabilitySupport
-
public final class MutabilitySupport extends Object
Mutability support for file based sources.Provides support for polling based strategy (
poll(java.nio.file.Path, java.time.Duration, java.util.function.Consumer, java.util.function.Consumer)) and for file watching (watch(java.nio.file.Path, java.util.function.Consumer, java.util.function.Consumer)).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Runnablepoll(Path path, Duration duration, Consumer<Path> updater, Consumer<Path> cleaner)Start polling for changes.static Runnablewatch(Path path, Consumer<Path> updater, Consumer<Path> cleaner)Start watching a file for changes.
-
-
-
Method Detail
-
poll
public static Runnable poll(Path path, Duration duration, Consumer<Path> updater, Consumer<Path> cleaner)
Start polling for changes.- Parameters:
path- path to watchduration- duration of pollingupdater- consumer that reads the file content and updates properties (in case file is changed)cleaner- runnable to clean the properties (in case file is deleted)- Returns:
- runnable to stop the file watcher
-
watch
public static Runnable watch(Path path, Consumer<Path> updater, Consumer<Path> cleaner)
Start watching a file for changes.- Parameters:
path- path to watchupdater- consumer that reads the file content and updates propertiescleaner- runnable to clean the properties (in case file is deleted)- Returns:
- runnable to stop the file watcher
-
-