You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2009/04/03 03:45:35 UTC

svn commit: r761500 - /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java

Author: ffang
Date: Fri Apr  3 01:45:35 2009
New Revision: 761500

URL: http://svn.apache.org/viewvc?rev=761500&view=rev
Log:
[SMXCOMP-500]ensure the cxf consumer's classloader is used for its interceptor chain

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=761500&r1=761499&r2=761500&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Fri Apr  3 01:45:35 2009
@@ -168,6 +168,7 @@
     
     private boolean isSTFlow; 
         
+    private ClassLoader suClassLoader;
     
     /**
      * @return the wsdl
@@ -387,6 +388,7 @@
     @Override
     public void validate() throws DeploymentException {
         try {
+            suClassLoader = Thread.currentThread().getContextClassLoader(); 
             if (definition == null) {
                 retrieveWSDL();
             }
@@ -622,7 +624,20 @@
                     .getContext());
             exchange.put(CxfBcConsumer.class, CxfBcConsumer.this);
         }
-
+        
+        public void onMessage(Message m) {
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            if (oldCl != suClassLoader) {
+                try {
+                    Thread.currentThread().setContextClassLoader(suClassLoader);
+                    super.onMessage(m);
+                } finally {
+                    Thread.currentThread().setContextClassLoader(oldCl);
+                }
+            } else {
+                super.onMessage(m);
+            }
+        }
     }
 
     public class JbiInvokerInterceptor extends