Package jetbrains.buildServer.serverSide
Class FileWatchingPropertiesModel
- java.lang.Object
-
- jetbrains.buildServer.serverSide.BasePropertiesModel
-
- jetbrains.buildServer.serverSide.FileWatchingPropertiesModel
-
- All Implemented Interfaces:
TeamCityProperties.Model
- Direct Known Subclasses:
TeamCityServerPropertiesModel
public class FileWatchingPropertiesModel extends BasePropertiesModel
Provides implementation ofTeamCityProperties
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.
UsesetFileWatcherSleepingPeriod(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 =).- Since:
- 8.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_PROPERTIES_FILE_NAME
-
Constructor Summary
Constructors Modifier Constructor Description FileWatchingPropertiesModel(File propertiesFile)
Deprecated.protected
FileWatchingPropertiesModel(File propertiesFile, boolean updateProperties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forceReloadProperties()
static FileWatchingPropertiesModel
fromProperties(File propertiesFile)
FileWatcher
getFileWatcher()
Map<String,String>
getUserDefinedProperties()
File
getWatchingFilePath()
Returns the full path to theinternal.properties
file.void
setFileWatcherSleepingPeriod(long currentSleepingInterval)
void
startFileWatching()
void
stopFileWatching()
-
Methods inherited from class jetbrains.buildServer.serverSide.BasePropertiesModel
getDefaultUsedUserDefinedProperties, getPropertyOrNull, getSystemProperties, getSystemProperty, getUnusedUserDefinedProperties, getUserDefinedProperty, propertiesToMap, storeDefaultValue
-
-
-
-
Field Detail
-
DEFAULT_PROPERTIES_FILE_NAME
public static final String DEFAULT_PROPERTIES_FILE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileWatchingPropertiesModel
@Deprecated public FileWatchingPropertiesModel(@NotNull File propertiesFile)
Deprecated.
-
FileWatchingPropertiesModel
protected FileWatchingPropertiesModel(@NotNull File propertiesFile, boolean updateProperties)
-
-
Method Detail
-
fromProperties
@NotNull public static FileWatchingPropertiesModel fromProperties(@NotNull File propertiesFile)
-
getUserDefinedProperties
@NotNull public Map<String,String> getUserDefinedProperties()
- Specified by:
getUserDefinedProperties
in interfaceTeamCityProperties.Model
- Overrides:
getUserDefinedProperties
in classBasePropertiesModel
- Returns:
- User provided properties map. In some implementations internal.properties file is used
-
getFileWatcher
@NotNull public FileWatcher getFileWatcher()
-
setFileWatcherSleepingPeriod
public void setFileWatcherSleepingPeriod(long currentSleepingInterval)
-
stopFileWatching
public void stopFileWatching()
-
startFileWatching
public void startFileWatching()
-
forceReloadProperties
public void forceReloadProperties()
-
getWatchingFilePath
@NotNull public File getWatchingFilePath()
Returns the full path to theinternal.properties
file. If properties file is not initialized yet, an empty string is returned.- Returns:
- full path
-
-