Module org.github.gestalt.core
Package org.github.gestalt.config.reload
Class FileChangeReloadStrategy
- java.lang.Object
-
- org.github.gestalt.config.reload.ConfigReloadStrategy
-
- org.github.gestalt.config.reload.FileChangeReloadStrategy
-
public final class FileChangeReloadStrategy extends ConfigReloadStrategy
File change reload strategy for listening for local file changes.Listens for local file changes including symlink changes.
Creates a thread in the background to watch for file changes.
-
-
Field Summary
-
Fields inherited from class org.github.gestalt.config.reload.ConfigReloadStrategy
listeners, source
-
-
Constructor Summary
Constructors Constructor Description FileChangeReloadStrategy()constructor.FileChangeReloadStrategy(java.util.concurrent.ExecutorService executor)constructor.FileChangeReloadStrategy(ConfigSource source)constructor.FileChangeReloadStrategy(ConfigSource source, java.util.concurrent.ExecutorService executor)constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidregisterListener(ConfigReloadListener listener)Add a config reload listener.voidremoveListener(ConfigReloadListener listener)Remove a config reload listener.voidsetSource(ConfigSource source)set the source this reload strategy should apply to.-
Methods inherited from class org.github.gestalt.config.reload.ConfigReloadStrategy
getSource, reload
-
-
-
-
Constructor Detail
-
FileChangeReloadStrategy
public FileChangeReloadStrategy() throws GestaltConfigurationExceptionconstructor.- Throws:
GestaltConfigurationException- if this is not a file source or other errors.
-
FileChangeReloadStrategy
public FileChangeReloadStrategy(java.util.concurrent.ExecutorService executor) throws GestaltConfigurationExceptionconstructor.- Parameters:
executor- executor to run the watcher on.- Throws:
GestaltConfigurationException- if this is not a file source or other errors.
-
FileChangeReloadStrategy
public FileChangeReloadStrategy(ConfigSource source) throws GestaltConfigurationException
constructor.- Parameters:
source- the source to watch for reload- Throws:
GestaltConfigurationException- if this is not a file source or other errors.
-
FileChangeReloadStrategy
public FileChangeReloadStrategy(ConfigSource source, java.util.concurrent.ExecutorService executor) throws GestaltConfigurationException
constructor.- Parameters:
source- the source to watch for reloadexecutor- ExecutorService to get thread from.- Throws:
GestaltConfigurationException- if this is not a file source or other errors.
-
-
Method Detail
-
setSource
public void setSource(ConfigSource source) throws GestaltConfigurationException
Description copied from class:ConfigReloadStrategyset the source this reload strategy should apply to.- Overrides:
setSourcein classConfigReloadStrategy- Parameters:
source- the source this reload strategy should apply to.- Throws:
GestaltConfigurationException- if there is an exception setting the source
-
registerListener
public void registerListener(ConfigReloadListener listener)
Description copied from class:ConfigReloadStrategyAdd a config reload listener.- Overrides:
registerListenerin classConfigReloadStrategy- Parameters:
listener- a config reload listener.
-
removeListener
public void removeListener(ConfigReloadListener listener)
Description copied from class:ConfigReloadStrategyRemove a config reload listener.- Overrides:
removeListenerin classConfigReloadStrategy- Parameters:
listener- a config reload listener.
-
-