You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/05/30 21:36:51 UTC

svn commit: r410352 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java

Author: gnodet
Date: Tue May 30 12:36:50 2006
New Revision: 410352

URL: http://svn.apache.org/viewvc?rev=410352&view=rev
Log:
Too much synchro on ComponentRegistry

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java?rev=410352&r1=410351&r2=410352&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java Tue May 30 12:36:50 2006
@@ -105,9 +105,11 @@
     }
     
     private Collection getReverseComponents() {
-        ArrayList l = new ArrayList(getComponents());
-        Collections.reverse(l);
-        return l;
+        synchronized (idMap) {
+            ArrayList l = new ArrayList(idMap.values());
+            Collections.reverse(l);
+            return l;
+        }
     }
 
     
@@ -125,16 +127,20 @@
      * @param id
      * @return the ComponentConnector or null
      */
-    public synchronized ComponentMBeanImpl getComponent(ComponentNameSpace id) {
-        return (ComponentMBeanImpl) idMap.get(id);
+    public ComponentMBeanImpl getComponent(ComponentNameSpace id) {
+        synchronized (idMap) {
+            return (ComponentMBeanImpl) idMap.get(id);
+        }
     }
     
     /**
      * 
      * @return Collection of ComponentConnectors held by the registry
      */
-    public synchronized Collection getComponents() {
-        return idMap.values();
+    public Collection getComponents() {
+        synchronized (idMap) {
+            return new ArrayList(idMap.values());
+        }
     }
 
     private boolean setInitialRunningStateFromStart() throws JBIException{