You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2011/11/08 12:00:57 UTC

svn commit: r1199186 - /tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java

Author: antelder
Date: Tue Nov  8 11:00:57 2011
New Revision: 1199186

URL: http://svn.apache.org/viewvc?rev=1199186&view=rev
Log:
TUSCANY-3969: add fix from JIRA as suggested by Jennifer Thompson and Greg Dritschler 

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java?rev=1199186&r1=1199185&r2=1199186&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java Tue Nov  8 11:00:57 2011
@@ -208,6 +208,31 @@ public class RRBJMSBindingInvoker extend
 
             context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
             context.setReplyToDestination(getReplyToDestination(session));
+            Long ttl = jmsBinding.getOperationJMSTimeToLive(operationName);
+            if (ttl != null) {
+                context.setTimeToLive(ttl);
+            }
+
+            // For twoway operations, determine a request timeout.
+            // The SCA specs do not address how to do this. We use the following approach.
+            // - If JMSTimeToLive is specified, use double that value.
+            // Doubling is basically arbitrary. JMSTimeToLive expresses request
+            // transmission and queue time. Doubling it allows request execution
+            // and response delivery to take up to the same amount of time.
+            // Note that explicitly coding a JMSTimeToLive of 0 results in
+            // a message that doesn't expire and an indefinite wait.
+            // - If JMSTimeToLive is not specified, get the default request
+            // timeout from the JMS resource factory and simply use that for the
+            // request timeout and JMSTimeToLive value.
+            if (!operation.isNonBlocking()) {
+                if (ttl != null) {
+                    context.setRequestTimeout(ttl * 2);
+                } else {
+                    long timeout = jmsResourceFactory.getDefaultRequestTimeout();
+                    context.setRequestTimeout(timeout);
+                    context.setTimeToLive(timeout);
+                }
+            }
             
             try {
                 tuscanyMsg = endpointReference.getBindingInvocationChain().getHeadInvoker().invoke(tuscanyMsg);