You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2008/02/28 03:57:31 UTC

svn commit: r631821 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java

Author: dims
Date: Wed Feb 27 18:57:18 2008
New Revision: 631821

URL: http://svn.apache.org/viewvc?rev=631821&view=rev
Log:
[PERF] Analysis from David Strite. The fairly new EndpointController.requestReceived() has an overhead for an echo. The actual call 
to the factory isn't very expensive. The cost seems to come from iterating over the values of a synchronized map. Storing the factories 
in a non-synchronized list would mostly eliminate this overhead.


Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java?rev=631821&r1=631820&r2=631821&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/InvocationListenerRegistry.java Wed Feb 27 18:57:18 2008
@@ -23,6 +23,8 @@
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 import org.apache.axis2.jaxws.server.EndpointCallback;
 import org.apache.axis2.jaxws.server.InvocationListenerFactory;
@@ -42,11 +44,8 @@
     
     private static final Log log = LogFactory.getLog(InvocationListenerRegistry.class);
     
-    private static Map<String, InvocationListenerFactory> factoryMap = 
-        new Hashtable<String, InvocationListenerFactory>();
-    
     // This is a collection of all the InvocationListenerFactory instances
-    private static Collection<InvocationListenerFactory> factoryCollection = null;
+    private static Collection<InvocationListenerFactory> factoryList = new ArrayList<InvocationListenerFactory>();
     
     /**
      * This method accepts an object instance that is an implementation of
@@ -57,7 +56,17 @@
         if(log.isDebugEnabled()) {
             log.debug("Adding InvocationListenerFactory instance: " + facInstance.getClass().getName());
         }
-        factoryMap.put(facInstance.getClass().getName(), facInstance);
+        // Ensure only one instance of a specific factory class is registered.
+        boolean found = false;
+        for (Iterator<InvocationListenerFactory> iterator = factoryList.iterator(); iterator.hasNext();) {
+            InvocationListenerFactory factory = iterator.next();
+            if (facInstance.getClass() == factory.getClass()) {
+                found = true;
+            }
+        }
+        if(!found){
+            factoryList.add(facInstance);
+        }
     }
     
     /**
@@ -65,7 +74,7 @@
      * that have been registered.
      */
     public static Collection<InvocationListenerFactory> getFactories() {
-        return factoryMap.values();
+        return factoryList;
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org