public class FileWatchingPropertiesModel extends BasePropertiesModel
TeamCityProperties
model that
encapsulates check of user-provided file.
Call to startFileWatching()
enables file watcher. By default
file is checked every 10 seconds. This class is not intended to be
used from non-TeamCity core code.
Use setFileWatcherSleepingPeriod(long)
or
"teamcity.internal.properties.reread.interval.ms"
property to
change the default value. The properties is checked in the loading/watching file.
Performance note: all access methods are never blocked to read the value from the file.
In case the file is removed, last used properties map is in effect.
Also note that the errors are not reported to the log, because the log environment might be not
initialized yet (it can require a system property for that =).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_PROPERTIES_FILE_NAME |
Modifier | Constructor and Description |
---|---|
|
FileWatchingPropertiesModel(java.io.File propertiesFile)
Deprecated.
|
protected |
FileWatchingPropertiesModel(java.io.File propertiesFile,
boolean updateProperties) |
Modifier and Type | Method and Description |
---|---|
void |
forceReloadProperties() |
static FileWatchingPropertiesModel |
fromProperties(java.io.File propertiesFile) |
FileWatcher |
getFileWatcher() |
java.util.Map<java.lang.String,java.lang.String> |
getUserDefinedProperties() |
java.io.File |
getWatchingFilePath()
Returns the full path to the
internal.properties file. |
void |
setFileWatcherSleepingPeriod(long currentSleepingInterval) |
void |
startFileWatching() |
void |
stopFileWatching() |
getDefaultUsedUserDefinedProperties, getPropertyOrNull, getSystemProperties, getSystemProperty, getUnusedUserDefinedProperties, getUserDefinedProperty, propertiesToMap, storeDefaultValue
public static final java.lang.String DEFAULT_PROPERTIES_FILE_NAME
@Deprecated public FileWatchingPropertiesModel(@NotNull java.io.File propertiesFile)
fromProperties(File)
protected FileWatchingPropertiesModel(@NotNull java.io.File propertiesFile, boolean updateProperties)
@NotNull public static FileWatchingPropertiesModel fromProperties(@NotNull java.io.File propertiesFile)
@NotNull public java.util.Map<java.lang.String,java.lang.String> getUserDefinedProperties()
getUserDefinedProperties
in interface TeamCityProperties.Model
getUserDefinedProperties
in class BasePropertiesModel
@NotNull public FileWatcher getFileWatcher()
public void setFileWatcherSleepingPeriod(long currentSleepingInterval)
public void stopFileWatching()
public void startFileWatching()
public void forceReloadProperties()
@NotNull public java.io.File getWatchingFilePath()
internal.properties
file.
If properties file is not initialized yet, an empty string is returned.