summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-11-08 11:00:57 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-11-08 11:00:57 +0000
commitf93345913961125410c1d2f7e74407dd1d0fdd70 (patch)
tree0e58951fc542f9d53c8a7a5ab740b82202c2dfdc
parent53d14f7330babbff03b059d775858cc9e6d2c3e9 (diff)
TUSCANY-3969: add fix from JIRA as suggested by Jennifer Thompson and Greg Dritschler
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1199186 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
index 0e88b283dc..06a061cdd9 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
@@ -208,6 +208,31 @@ public class RRBJMSBindingInvoker extends InterceptorAsyncImpl {
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);