See below code, this puzzles me, in class DynamicPropertyFactory, it locks ConfigurationManager.class, as my understanding, the lock works only in the class or the instance itself. How to understand this?
public class *DynamicPropertyFactory*{
public static *DynamicPropertyFactory* initWithConfigurationSource(AbstractConfiguration config) {
synchronized (**ConfigurationManager.class**) {
if (config == null) {
throw new NullPointerException("config is null");
}
if (ConfigurationManager.isConfigurationInstalled() && config != ConfigurationManager.instance) {
throw new IllegalStateException("ConfigurationManager is already initialized with configuration "
+ ConfigurationManager.getConfigInstance());
}
if (config instanceof DynamicPropertySupport) {
return initWithConfigurationSource((DynamicPropertySupport) config);
}
return initWithConfigurationSource(new ConfigurationBackedDynamicPropertySupportImpl(config));
}
}
}