cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1457954 - in /cxf/branches/2.7.x-fixes: api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Date Mon, 18 Mar 2013 20:05:04 GMT
Author: dkulp
Date: Mon Mar 18 20:05:04 2013
New Revision: 1457954

URL: http://svn.apache.org/r1457954
Log:
Merged revisions 1456875 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1456875 | asoldano | 2013-03-15 06:42:03 -0400 (Fri, 15 Mar 2013) | 2 lines

  [CXF-4896] Performance optimization: avoid duplicated reflection usage to speed up creation
of java-first endpoints

........

Modified:
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java
    cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java?rev=1457954&r1=1457953&r2=1457954&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java
(original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/common/util/ReflectionInvokationHandler.java
Mon Mar 18 20:05:04 2013
@@ -76,8 +76,9 @@ public class ReflectionInvokationHandler
     }
     private Class<?>[] getParameterTypes(Method method, Object[] args) {
         Class<?>[] types = method.getParameterTypes();
+        final Annotation[][] parAnnotations = method.getParameterAnnotations();
         for (int x = 0; x < types.length; x++) {
-            UnwrapParam p = getUnwrapParam(method.getParameterAnnotations()[x]);
+            UnwrapParam p = getUnwrapParam(parAnnotations[x]);
             if (p != null) {
                 String s = p.methodName();
                 String tn = p.typeMethodName();

Modified: cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1457954&r1=1457953&r2=1457954&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Mon Mar 18 20:05:04 2013
@@ -990,14 +990,16 @@ public class ReflectionServiceFactoryBea
         OperationInfo op = intf.addOperation(getOperationName(intf, m));
         op.setProperty(m.getClass().getName(), m);
         op.setProperty("action", getAction(op, m));
-        op.setProperty(METHOD_ANNOTATIONS, m.getAnnotations());
-        op.setProperty(METHOD_PARAM_ANNOTATIONS, m.getParameterAnnotations());
+        final Annotation[] annotations = m.getAnnotations();
+        final Annotation[][] parAnnotations = m.getParameterAnnotations();
+        op.setProperty(METHOD_ANNOTATIONS, annotations);
+        op.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
 
         boolean isrpc = isRPC(m);
         if (!isrpc && isWrapped(m)) {
             UnwrappedOperationInfo uOp = new UnwrappedOperationInfo(op);
-            uOp.setProperty(METHOD_ANNOTATIONS, m.getAnnotations());
-            uOp.setProperty(METHOD_PARAM_ANNOTATIONS, m.getParameterAnnotations());
+            uOp.setProperty(METHOD_ANNOTATIONS, annotations);
+            uOp.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
             op.setUnwrappedOperation(uOp);
 
             createMessageParts(intf, uOp, m);
@@ -1506,6 +1508,8 @@ public class ReflectionServiceFactoryBea
         op.setProperty(METHOD, method);
         MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method), MessageInfo.Type.INPUT);
         op.setInput(inMsg.getName().getLocalPart(), inMsg);
+        final Annotation[][] parAnnotations = method.getParameterAnnotations();
+        final Type[] genParTypes = method.getGenericParameterTypes();
         for (int j = 0; j < paramClasses.length; j++) {
             if (Exchange.class.equals(paramClasses[j])) {
                 continue;
@@ -1523,10 +1527,10 @@ public class ReflectionServiceFactoryBea
 
 
 
-                initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
+                initializeParameter(part, paramClasses[j], genParTypes[j]);
                 //TODO:remove method param annotations
-                part.setProperty(METHOD_PARAM_ANNOTATIONS, method.getParameterAnnotations());
-                part.setProperty(PARAM_ANNOTATION, method.getParameterAnnotations()[j]);
+                part.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
+                part.setProperty(PARAM_ANNOTATION, parAnnotations[j]);
                 if (getJaxbAnnoMap(part).size() > 0) {
                     op.setProperty(WRAPPERGEN_NEEDED, true);
                 }
@@ -1562,8 +1566,9 @@ public class ReflectionServiceFactoryBea
                 if (!isRPC(method) && !isWrapped(method)) {
                     part.setProperty(ELEMENT_NAME, q2);
                 }
-                part.setProperty(METHOD_ANNOTATIONS, method.getAnnotations());
-                part.setProperty(PARAM_ANNOTATION, method.getAnnotations());
+                final Annotation[] annotations = method.getAnnotations();
+                part.setProperty(METHOD_ANNOTATIONS, annotations);
+                part.setProperty(PARAM_ANNOTATION, annotations);
                 if (isHeader(method, -1)) {
                     part.setProperty(HEADER, Boolean.TRUE);
                     if (isRPC(method) || !isWrapped(method)) {
@@ -1597,9 +1602,9 @@ public class ReflectionServiceFactoryBea
                     }
 
                     MessagePartInfo part = outMsg.addMessagePart(q);
-                    part.setProperty(METHOD_PARAM_ANNOTATIONS, method.getParameterAnnotations());
-                    part.setProperty(PARAM_ANNOTATION, method.getParameterAnnotations()[j]);
-                    initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
+                    part.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
+                    part.setProperty(PARAM_ANNOTATION, parAnnotations[j]);
+                    initializeParameter(part, paramClasses[j], genParTypes[j]);
                     part.setIndex(j + 1);
 
                     if (!isRPC(method) && !isWrapped(method)) {
@@ -1806,9 +1811,10 @@ public class ReflectionServiceFactoryBea
                 processParameterizedTypes();
             }
             TypeVariable<?> var = (TypeVariable<?>)type;
-            Map<String, Class<?>> mp = parameterizedTypes.get(var.getGenericDeclaration());
+            final Object gd = var.getGenericDeclaration();
+            Map<String, Class<?>> mp = parameterizedTypes.get(gd);
             if (mp != null) {
-                Class<?> c = parameterizedTypes.get(var.getGenericDeclaration()).get(var.getName());
+                Class<?> c = parameterizedTypes.get(gd).get(var.getName());
                 if (c != null) {
                     rawClass = c;
                     type = c;
@@ -2348,8 +2354,10 @@ public class ReflectionServiceFactoryBea
         if (serviceClass.isInterface()) {
             processTypes(serviceClass, serviceType);
         } else {
-            for (int x = 0; x < serviceClass.getInterfaces().length; x++) {
-                processTypes(serviceClass.getInterfaces()[x], serviceClass.getGenericInterfaces()[x]);
+            final Class<?>[] interfaces = serviceClass.getInterfaces();
+            final Type[] genericInterfaces = serviceClass.getGenericInterfaces();
+            for (int x = 0; x < interfaces.length; x++) {
+                processTypes(interfaces[x], genericInterfaces[x]);
             }
             processTypes(serviceClass.getSuperclass(), serviceClass.getGenericSuperclass());
         }
@@ -2360,9 +2368,11 @@ public class ReflectionServiceFactoryBea
             Type c = ptp.getRawType();
             Map<String, Class<?>> m = new HashMap<String, Class<?>>();
             parameterizedTypes.put(c, m);
-            for (int x = 0; x < ptp.getActualTypeArguments().length; x++) {
-                Type t = ptp.getActualTypeArguments()[x];
-                TypeVariable<?> tv = sc.getTypeParameters()[x];
+            final Type[] ptpActualTypeArgs = ptp.getActualTypeArguments();
+            final TypeVariable<?>[] scTypeArgs = sc.getTypeParameters();
+            for (int x = 0; x < ptpActualTypeArgs.length; x++) {
+                Type t = ptpActualTypeArgs[x];
+                TypeVariable<?> tv = scTypeArgs[x];
                 if (t instanceof Class) {
                     m.put(tv.getName(), (Class<?>)t);
                 }



Mime
View raw message