You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gu...@apache.org on 2013/06/07 13:52:32 UTC
svn commit: r1490600 -
/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
Author: guillaume
Date: Fri Jun 7 11:52:31 2013
New Revision: 1490600
URL: http://svn.apache.org/r1490600
Log:
FELIX-4108 Deadlock in the new extender
* Use a ConcurrentHashMap to avoid synchronized blocks
Modified:
felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java?rev=1490600&r1=1490599&r2=1490600&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java (original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java Fri Jun 7 11:52:31 2013
@@ -32,6 +32,7 @@ import org.osgi.framework.ServiceRegistr
import org.osgi.service.cm.ManagedServiceFactory;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* This class defines common mechanisms of iPOJO component factories
@@ -63,7 +64,7 @@ public abstract class IPojoFactory imple
* The list of the managed instance managers.
* The key of this map is the name (i.e. instance names) of the created instance
*/
- protected final Map<String, ComponentInstance> m_componentInstances = new HashMap<String, ComponentInstance>();
+ protected final Map<String, ComponentInstance> m_componentInstances = new ConcurrentHashMap<String, ComponentInstance>();
/**
* The component type metadata.
@@ -421,9 +422,7 @@ public abstract class IPojoFactory imple
* @return the component instance, {@literal null} if not found
*/
public ComponentInstance getInstanceByName(String name) {
- synchronized (this) {
- return m_componentInstances.get(name);
- }
+ return m_componentInstances.get(name);
}
/**
@@ -720,9 +719,7 @@ public abstract class IPojoFactory imple
*/
public void disposed(ComponentInstance instance) {
String name = instance.getInstanceName();
- synchronized (this) {
- m_componentInstances.remove(name);
- }
+ m_componentInstances.remove(name);
INSTANCE_NAME.remove(name);
}