servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r886185 - /servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java
Date Wed, 02 Dec 2009 15:52:20 GMT
Author: eglynn
Date: Wed Dec  2 15:52:20 2009
New Revision: 886185

URL: http://svn.apache.org/viewvc?rev=886185&view=rev
Log:
Fix for [SMX4NMR-174] [clustering] Classloading failure on unmarshalling incoming replicated
messages

Modified:
    servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java

Modified: servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java?rev=886185&r1=886184&r2=886185&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java
(original)
+++ servicemix/smx4/nmr/trunk/jbi/cluster/engine/src/main/java/org/apache/servicemix/jbi/cluster/engine/ClusterEngine.java
Wed Dec  2 15:52:20 2009
@@ -643,7 +643,7 @@
                 // Re-process JBI addressing
                 DeliveryChannelImpl.createTarget(getChannel().getNMR(), exchange);
                 // TODO: read exchange properties
-                Message msg = (Message) ((ObjectMessage) message).getObject();
+                Message msg = unmarshallMessage(message);
                 exchange.setIn(msg);
                 exchanges.put(exchange.getId(), exchange);
                 if (pendingExchanges.incrementAndGet() >= maxPendingExchanges) {
@@ -668,7 +668,7 @@
                 if (exchange == null) {
                     throw new IllegalStateException("Exchange not found for id " + corrId);
                 }
-                Message msg = (Message) ((ObjectMessage) message).getObject();
+                Message msg = unmarshallMessage(message);
                 exchange.setOut(msg);
                 exchanges.put(exchange.getId(), exchange);
                 exchange.setProperty(PROPERTY_CORR_ID + "." + name, exchange.getId());
@@ -688,7 +688,7 @@
                 if (exchange == null) {
                     throw new IllegalStateException("Exchange not found for id " + corrId);
                 }
-                Message msg = (Message) ((ObjectMessage) message).getObject();
+                Message msg = unmarshallMessage(message);
                 exchange.setFault(msg);
                 exchanges.put(exchange.getId(), exchange);
                 exchange.setProperty(PROPERTY_CORR_ID + "." + name, exchange.getId());
@@ -893,4 +893,15 @@
         }
     }
 
+    protected Message unmarshallMessage(javax.jms.Message message) throws JMSException {
+        Message msg = null;
+        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+            msg = (Message) ((ObjectMessage) message).getObject();
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
+        return msg;
+    }
 }



Mime
View raw message