-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(): rollback meaningless change
- Loading branch information
Showing
7 changed files
with
38 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,21 +33,21 @@ | |
* @author Jason Song([email protected]) | ||
*/ | ||
public class DefaultConfigManager implements ConfigManager { | ||
|
||
protected Map<String, Config> m_configs = Maps.newConcurrentMap(); | ||
protected Map<String, Object> m_configLocks = Maps.newConcurrentMap(); | ||
protected Map<String, ConfigFile> m_configFiles = Maps.newConcurrentMap(); | ||
protected Map<String, Object> m_configFileLocks = Maps.newConcurrentMap(); | ||
private ConfigFactoryManager m_factoryManager; | ||
|
||
private Map<String, Config> m_configs = Maps.newConcurrentMap(); | ||
private Map<String, Object> m_configLocks = Maps.newConcurrentMap(); | ||
private Map<String, ConfigFile> m_configFiles = Maps.newConcurrentMap(); | ||
private Map<String, Object> m_configFileLocks = Maps.newConcurrentMap(); | ||
|
||
public DefaultConfigManager() { | ||
m_factoryManager = ApolloInjector.getInstance(ConfigFactoryManager.class); | ||
|
||
} | ||
|
||
@Override | ||
public Config getConfig(String namespace) { | ||
Config config = m_configs.get(namespace); | ||
|
||
if (config == null) { | ||
Object lock = m_configLocks.computeIfAbsent(namespace, key -> new Object()); | ||
synchronized (lock) { | ||
|
@@ -61,16 +61,15 @@ public Config getConfig(String namespace) { | |
} | ||
} | ||
} | ||
if(!ConfigSourceType.NONE.equals(config.getSourceType())) { | ||
Tracer.logMetricsForCount(APOLLO_CLIENT_NAMESPACE_USAGE+":"+namespace); | ||
if (!ConfigSourceType.NONE.equals(config.getSourceType())) { | ||
Tracer.logMetricsForCount(APOLLO_CLIENT_NAMESPACE_USAGE + ":" + namespace); | ||
} | ||
|
||
return config; | ||
} | ||
|
||
@Override | ||
public ConfigFile getConfigFile(String namespace, | ||
ConfigFileFormat configFileFormat) { | ||
public ConfigFile getConfigFile(String namespace, ConfigFileFormat configFileFormat) { | ||
String namespaceFileName = String.format("%s.%s", namespace, configFileFormat.getValue()); | ||
ConfigFile configFile = m_configFiles.get(namespaceFileName); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,6 @@ | |
import com.google.inject.Singleton; | ||
import java.util.List; | ||
|
||
; | ||
|
||
/** | ||
* Guice injector | ||
* @author Jason Song([email protected]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters