You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2017/03/15 09:51:20 UTC
cxf git commit: Move getting exchange into a method
Repository: cxf
Updated Branches:
refs/heads/master a911f8cf5 -> d6ceada3c
Move getting exchange into a method
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d6ceada3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d6ceada3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d6ceada3
Branch: refs/heads/master
Commit: d6ceada3c239183801308e8226d76227320c614a
Parents: a911f8c
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Wed Mar 15 10:48:57 2017 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Wed Mar 15 10:48:57 2017 +0100
----------------------------------------------------------------------
.../apache/cxf/transport/jms/JMSConduit.java | 42 +++++++++++++-------
1 file changed, 27 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/d6ceada3/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
index 1020398..1c432e3 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
@@ -366,31 +366,43 @@ public class JMSConduit extends AbstractConduit implements JMSExchangeSender, Me
String correlationId = jmsMessage.getJMSCorrelationID();
LOG.log(Level.FINE, "Received reply message with correlation id " + correlationId);
- // Try to correlate the incoming message with some timeout as it may have been
- // added to the map after the message was sent
- int count = 0;
- Exchange exchange = null;
- while (exchange == null && count < 100) {
- exchange = correlationMap.remove(correlationId);
- if (exchange == null) {
- Thread.sleep(1);
- }
- count++;
- }
+ Exchange exchange = getExchange(correlationId);
if (exchange == null) {
LOG.log(Level.WARNING, "Could not correlate message with correlationId " + correlationId);
- return;
+ } else {
+ processReplyMessage(exchange, jmsMessage);
}
- processReplyMessage(exchange, jmsMessage);
} catch (JMSException e) {
throw JMSUtil.convertJmsException(e);
- } catch (InterruptedException e) {
- throw new RuntimeException("Interrupted while correlating", e);
}
}
/**
+ * Try to correlate the incoming message with some timeout as it may have been
+ * added to the map after the message was sent
+ *
+ * @param correlationId
+ * @return exchange for correlationId or null if none was found
+ */
+ private Exchange getExchange(String correlationId) {
+ int count = 0;
+ Exchange exchange = null;
+ while (exchange == null && count < 100) {
+ exchange = correlationMap.remove(correlationId);
+ if (exchange == null) {
+ try {
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Interrupted while correlating", e);
+ }
+ }
+ count++;
+ }
+ return exchange;
+ }
+
+ /**
* Process the reply message
* @throws JMSException
*/