From f93345913961125410c1d2f7e74407dd1d0fdd70 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 8 Nov 2011 11:00:57 +0000 Subject: 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 --- .../binding/jms/provider/RRBJMSBindingInvoker.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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); -- cgit v1.2.3