cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1383529 - /cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
Date Tue, 11 Sep 2012 18:39:20 GMT
Author: dkulp
Date: Tue Sep 11 18:39:20 2012
New Revision: 1383529

URL: http://svn.apache.org/viewvc?rev=1383529&view=rev
Log:
Merged revisions 1383462 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1383462 | dkulp | 2012-09-11 12:05:14 -0400 (Tue, 11 Sep 2012) | 2 lines

  If a bunch of threads try and create a helper at the same time, wastes memory and processing
time.  Prevent that.

........

Modified:
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java?rev=1383529&r1=1383528&r2=1383529&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
Tue Sep 11 18:39:20 2012
@@ -73,19 +73,11 @@ public class WrapperClassOutInterceptor 
 
         if (wrapped != null) {
             MessageContentsList objs = MessageContentsList.getContentsList(message);
-
             WrapperHelper helper = parts.get(0).getProperty("WRAPPER_CLASS", WrapperHelper.class);
             if (helper == null) {
-                Service service = ServiceModelUtil.getService(message.getExchange());
-                DataBinding dataBinding = service.getDataBinding();
-                if (dataBinding instanceof WrapperCapableDatabinding) {
-                    helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding,
-                                                 messageInfo, wrappedMsgInfo, wrapped);
-                    parts.get(0).setProperty("WRAPPER_CLASS", helper);
-                } else {
-                    return;
-                }
+                helper = getWrapperHelper(message, messageInfo, wrappedMsgInfo, wrapped,
parts.get(0));
             }
+            
             try {
                 MessageContentsList newObjs = new MessageContentsList();
                 Object en = message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED);
@@ -136,6 +128,24 @@ public class WrapperClassOutInterceptor 
     }
 
 
+    private synchronized WrapperHelper getWrapperHelper(Message message,
+                                           MessageInfo messageInfo,
+                                           MessageInfo wrappedMessageInfo,
+                                           Class<?> wrapClass,
+                                           MessagePartInfo messagePartInfo) {
+        WrapperHelper helper = messagePartInfo.getProperty("WRAPPER_CLASS", WrapperHelper.class);
+        if (helper == null) {
+            Service service = ServiceModelUtil.getService(message.getExchange());
+            DataBinding dataBinding = service.getDataBinding();
+            if (dataBinding instanceof WrapperCapableDatabinding) {
+                helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding,
+                                             messageInfo, wrappedMessageInfo, wrapClass);
+                messagePartInfo.setProperty("WRAPPER_CLASS", helper);
+            }
+        }
+        return helper;
+    }
+
     private void ensureSize(List<?> lst, int idx) {
         while (idx >= lst.size()) {
             lst.add(null);



Mime
View raw message