You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2008/03/01 06:07:34 UTC

svn commit: r632552 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/handler/ metadata/src/org/apache/axis2/jaxws/description/ metadata/src/org/apache/axis2/jaxws/description/impl/

Author: dims
Date: Fri Feb 29 21:07:32 2008
New Revision: 632552

URL: http://svn.apache.org/viewvc?rev=632552&view=rev
Log:
Cache/lookup the list of classes for the handlers *only* if the service delegate is not set.  the cache is inside the ServiceDescription

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java?rev=632552&r1=632551&r2=632552&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java Fri Feb 29 21:07:32 2008
@@ -77,8 +77,19 @@
     }
 
     public List<Handler> getHandlerChain(PortInfo portinfo) {
-        // TODO:  would check and/or build cache here if implemented later
-        List<Class> handlerClasses = resolveHandlers(portinfo);
+        List<Class> handlerClasses = null;
+        // Look into the cache only if the service delegate key is null.
+        if (serviceDelegateKey == null) {
+            handlerClasses = serviceDesc.getHandlerChainClasses(portinfo);
+        }
+        if (handlerClasses == null) {
+            // resolve handlers if we did not find them in the cache
+            handlerClasses = resolveHandlers(portinfo);
+            // Store the list of classes
+            if (serviceDelegateKey == null) {
+                serviceDesc.setHandlerChainClasses(portinfo, handlerClasses);
+            }
+        }
         if (handlerClasses.size() == 0) {
             return new ArrayList<Handler>();
         }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java?rev=632552&r1=632551&r2=632552&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java Fri Feb 29 21:07:32 2008
@@ -23,6 +23,7 @@
 import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
 import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
 import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
 import java.util.Collection;
 import java.util.List;
 
@@ -144,4 +145,8 @@
     public QName getPreferredPort(Object key);
     
     public JAXWSCatalogManager getCatalogManager();
+
+    public List<Class> getHandlerChainClasses(PortInfo portinfo);
+
+    public void setHandlerChainClasses(PortInfo portinfo, List<Class> handlerClasses);
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=632552&r1=632551&r2=632552&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Fri Feb 29 21:07:32 2008
@@ -56,6 +56,7 @@
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.handler.PortInfo;
 import javax.xml.ws.soap.SOAPBinding;
 
 import java.io.FileNotFoundException;
@@ -103,6 +104,9 @@
     private Map<Object, Map<QName, EndpointDescriptionImpl>> dynamicEndpointDescriptions =
                 new WeakHashMap<Object, Map<QName, EndpointDescriptionImpl>>();
 
+    // Cache classes for the handler chain
+    Map<PortInfo, List<Class>> handlerClassesMap =
+            new WeakHashMap<PortInfo, List<Class>>();
     
     private static final Log log = LogFactory.getLog(ServiceDescriptionImpl.class);
 
@@ -2146,4 +2150,13 @@
 
         return cl;
     }
+
+    public List<Class> getHandlerChainClasses(PortInfo portinfo) {
+        return handlerClassesMap.get(portinfo);
+    }
+
+    public void setHandlerChainClasses(PortInfo portinfo, List<Class> handlerClasses) {
+        handlerClassesMap.put(portinfo, handlerClasses);
+    }
+
 }



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