FELIX-5177: it is safer to declare m_configType as volatile (as Jan Willem did in its initial patch), because we
can't predict how a component is started: if a component is created first in one thread, and started in another one, then
all component parameters should be stored in volatile variables.
I will have to make another JIRA issue in order to apply the same for all other component and dependencies API parameters.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1728617 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
index 3288216..1ada77f 100644
--- a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
@@ -49,11 +49,10 @@
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class ConfigurationDependencyImpl extends AbstractDependency<ConfigurationDependency> implements ConfigurationDependency, ManagedService {
- // Our fields are not volatile because they are "safely published" using the DM thread model (based on a Concurrent queue).
private Dictionary<String, Object> m_settings;
private String m_pid;
private ServiceRegistration m_registration;
- private Class<?> m_configType;
+ private volatile Class<?> m_configType;
private MetaTypeProviderImpl m_metaType;
private final AtomicBoolean m_updateInvokedCache = new AtomicBoolean();
private final Logger m_logger;