Author: bimargulies
Date: Mon Mar 17 18:38:32 2008
New Revision: 638170

URL: http://svn.apache.org/viewvc?rev=638170&view=rev
Log:
add another cache to reduce reflection costs.

Modified:
    
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=638170&r1=638169&r2=638170&view=diff
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
 Mon Mar 17 18:38:32 2008
@@ -67,10 +67,12 @@
      */
     private Map<Object, Class> responseMethodClassCache;
     private Map<Object, Class> requestMethodClassCache;
+    private Map<Method, Annotation[][]> methodAnnotationCache;
     
     public JaxWsServiceConfiguration() {
         responseMethodClassCache = new HashMap<Object, Class>();
         requestMethodClassCache = new HashMap<Object, Class>();
+        methodAnnotationCache = new HashMap<Method, Annotation[][]>();
     }
 
     @Override
@@ -318,7 +320,12 @@
     }
 
     private WebParam getWebParam(Method method, int parameter) {
-        Annotation[][] annotations = method.getParameterAnnotations();
+        // we could really use a centralized location for this.
+        Annotation[][] annotations = methodAnnotationCache.get(method);
+        if (annotations == null) {
+            annotations = method.getParameterAnnotations();
+            methodAnnotationCache.put(method, annotations);
+        } 
         if (parameter >= annotations.length) {
             return null;
         } else {
@@ -536,6 +543,7 @@
         if (clsName.length() > 0) {
             cachedClass = responseMethodClassCache.get(clsName);
             if (cachedClass != null) {
+                responseMethodClassCache.put(selected, cachedClass);
                 return cachedClass;
             }
             try {
@@ -599,6 +607,7 @@
         if (clsName.length() > 0) {
             cachedClass = requestMethodClassCache.get(clsName);
             if (cachedClass != null) {
+                requestMethodClassCache.put(selected, cachedClass);
                 return cachedClass;
             }
             try {


Reply via email to