Search in sources :

Example 1 with ConfigFileFactory

use of com.tencent.polaris.configuration.client.factory.ConfigFileFactory in project polaris-java by polarismesh.

the class DefaultConfigFileManager method getConfigKVFile.

@Override
public ConfigKVFile getConfigKVFile(ConfigFileMetadata configFileMetadata, ConfigFileFormat fileFormat) {
    ConfigKVFile configFile = configPropertiesFileCache.get(configFileMetadata);
    if (configFile == null) {
        synchronized (this) {
            configFile = configPropertiesFileCache.get(configFileMetadata);
            if (configFile == null) {
                ConfigFileFactory configFileFactory = configFileFactoryManager.getFactory(configFileMetadata);
                configFile = configFileFactory.createConfigKVFile(configFileMetadata, fileFormat);
                configPropertiesFileCache.put(configFileMetadata, configFile);
            }
        }
    }
    return configFile;
}
Also used : ConfigKVFile(com.tencent.polaris.configuration.api.core.ConfigKVFile) ConfigFileFactory(com.tencent.polaris.configuration.client.factory.ConfigFileFactory)

Example 2 with ConfigFileFactory

use of com.tencent.polaris.configuration.client.factory.ConfigFileFactory in project polaris-java by polarismesh.

the class DefaultConfigFileManager method getConfigFile.

@Override
public ConfigFile getConfigFile(ConfigFileMetadata configFileMetadata) {
    ConfigFile configFile = configFileCache.get(configFileMetadata);
    if (configFile == null) {
        synchronized (this) {
            configFile = configFileCache.get(configFileMetadata);
            if (configFile == null) {
                ConfigFileFactory configFileFactory = configFileFactoryManager.getFactory(configFileMetadata);
                configFile = configFileFactory.createConfigFile(configFileMetadata);
                configFileCache.put(configFileMetadata, configFile);
            }
        }
    }
    return configFile;
}
Also used : ConfigFile(com.tencent.polaris.configuration.api.core.ConfigFile) ConfigFileFactory(com.tencent.polaris.configuration.client.factory.ConfigFileFactory)

Aggregations

ConfigFileFactory (com.tencent.polaris.configuration.client.factory.ConfigFileFactory)2 ConfigFile (com.tencent.polaris.configuration.api.core.ConfigFile)1 ConfigKVFile (com.tencent.polaris.configuration.api.core.ConfigKVFile)1