cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1423914 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf: bus/extension/TextExtensionFragmentParser.java service/factory/ReflectionServiceFactoryBean.java
Date Wed, 19 Dec 2012 16:14:49 GMT
Author: asoldano
Date: Wed Dec 19 16:14:49 2012
New Revision: 1423914

URL: http://svn.apache.org/viewvc?rev=1423914&view=rev
Log:
[CXF-4712] A couple of perf improvements

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java?rev=1423914&r1=1423913&r2=1423914&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
Wed Dec 19 16:14:49 2012
@@ -28,11 +28,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.regex.Pattern;
 
 import org.apache.cxf.common.logging.LogUtils;
 
 public class TextExtensionFragmentParser {
     private static final Logger LOG = LogUtils.getL7dLogger(TextExtensionFragmentParser.class);
+    private static Pattern colonPattern = Pattern.compile(":");
     
     public List<Extension> getExtensions(final URL url) {
         InputStream is = null;
@@ -82,7 +84,7 @@ public class TextExtensionFragmentParser
             return null;
         }
         final Extension ext = new Extension();
-        String[] parts = line.split(":");
+        String[] parts = colonPattern.split(line, 0);
         ext.setClassname(parts[0]);
         if (ext.getClassname() == null) {
             return null;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1423914&r1=1423913&r2=1423914&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Dec 19 16:14:49 2012
@@ -39,6 +39,7 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executor;
@@ -900,6 +901,17 @@ public class ReflectionServiceFactoryBea
     }
     private void setFaultClassInfo(OperationInfo o, Method selected) {
         Class<?>[] types = selected.getExceptionTypes();
+        Map<FaultInfo, List<MessagePartInfo>> mpiMap = null;
+        if (types.length > 0) {
+            //early iterate over FaultInfo before cycling on exception types
+            //as fi.getMessageParts() is very time-consuming due to elements
+            //copy in ArrayList constructor
+            mpiMap = new HashMap<FaultInfo, List<MessagePartInfo>>();
+            for (FaultInfo fi : o.getFaults()) {
+                mpiMap.put(fi, fi.getMessageParts());
+            }
+        }
+        
         for (int i = 0; i < types.length; i++) {
             Class<?> exClass = types[i];
             Class<?> beanClass = getBeanClass(exClass);
@@ -909,8 +921,9 @@ public class ReflectionServiceFactoryBea
 
             QName name = getFaultName(o.getInterface(), o, exClass, beanClass);
 
-            for (FaultInfo fi : o.getFaults()) {
-                List<MessagePartInfo> mpis = fi.getMessageParts();
+            for (Entry<FaultInfo, List<MessagePartInfo>> entry : mpiMap.entrySet())
{
+                FaultInfo fi = entry.getKey();
+                List<MessagePartInfo> mpis = entry.getValue();
                 if (mpis.size() != 1) {
                     Message message = new Message("NO_FAULT_PART", LOG, fi.getFaultName());

                     LOG.log(Level.WARNING, message.toString());



Mime
View raw message