cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r703242 - in /cxf/branches/2.1.x-fixes: ./ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Date Thu, 09 Oct 2008 20:00:21 GMT
Author: dkulp
Date: Thu Oct  9 13:00:20 2008
New Revision: 703242

URL: http://svn.apache.org/viewvc?rev=703242&view=rev
Log:
Merged revisions 703239 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r703239 | dkulp | 2008-10-09 15:58:24 -0400 (Thu, 09 Oct 2008) | 2 lines
  
  Fix potential race condition where a response COULD come back before the waiting thread
was waiting for it.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct  9 13:00:20 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=703242&r1=703241&r2=703242&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Thu Oct  9 13:00:20 2008
@@ -109,13 +109,8 @@
 
         final String correlationId = (headers != null && headers.isSetJMSCorrelationID())
? headers
             .getJMSCorrelationID() : JMSUtils.generateCorrelationId();
-        // String selector = "JMSCorrelationID = '" + correlationId + "'";
-        Message inMessage = null;
-        if (!exchange.isOneWay()) {
-            inMessage = new MessageImpl();
-            correlationMap.put(correlationId, inMessage);
-        }
-        jmsTemplate.send(jmsConfig.getTargetDestination(), new MessageCreator() {
+            
+        MessageCreator messageCreator = new MessageCreator() {
             public javax.jms.Message createMessage(Session session) throws JMSException {
                 String messageType = jmsConfig.getMessageType();
                 final javax.jms.Message jmsMessage;
@@ -125,7 +120,7 @@
                 LOG.log(Level.FINE, "client sending request: ", jmsMessage);
                 return jmsMessage;
             }
-        });
+        };
 
         /**
          * If the message is not oneWay we will expect to receive a reply on the listener.
To receive this
@@ -133,10 +128,14 @@
          * fill to Message and notify this thread
          */
         if (!exchange.isOneWay()) {
+            Message inMessage = new MessageImpl();
             synchronized (inMessage) {
+                correlationMap.put(correlationId, inMessage);
+                jmsTemplate.send(jmsConfig.getTargetDestination(), messageCreator);
                 try {
                     inMessage.wait(jmsTemplate.getReceiveTimeout());
                 } catch (InterruptedException e) {
+                    correlationMap.remove(correlationId);
                     throw new RuntimeException(e);
                 }
                 correlationMap.remove(correlationId);
@@ -149,6 +148,8 @@
             if (incomingObserver != null) {
                 incomingObserver.onMessage(inMessage);
             }
+        } else {
+            jmsTemplate.send(jmsConfig.getTargetDestination(), messageCreator);
         }
     }
 



Mime
View raw message