diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-17 11:54:53 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-17 11:54:53 +0000 |
commit | 4fdfc31658c6542dcb557ec85d07a5794ab59599 (patch) | |
tree | 95d3fdbea005511ab18e81045be347ff9eafa02c /branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache | |
parent | 9bd7a93bc1ce7c7ea6e15f917297eae65bebecab (diff) |
TUSCANY-2839: Add checks to bypass response processing for oneway operations
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@744971 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache')
5 files changed, 37 insertions, 17 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java index 5012c24b65..848b75884f 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java @@ -35,6 +35,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -110,6 +111,14 @@ public class TransportServiceInterceptor implements Interceptor { public Message invokeResponse(Message msg) { try { + + //if operation is oneway, return back. + Operation operation = msg.getOperation(); + if (operation != null && operation.isNonBlocking()) { + jmsResourceFactory.closeConnection(); + return msg; + } + JMSBindingContext context = msg.getBindingContext(); Session session = context.getJmsResponseSession(); javax.jms.Message requestJMSMsg = context.getJmsMsg(); diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java index 8aabe1f510..5128309233 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java @@ -18,18 +18,15 @@ */ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime; -import javax.jms.JMSException; import javax.jms.Session; -import org.apache.tuscany.sca.assembly.WireFormat; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -65,6 +62,12 @@ public class WireFormatJMSBytesServiceInterceptor implements Interceptor { msg = getNext().invoke(msg); + //if it's oneway return back + Operation operation = msg.getOperation(); + if (operation != null && operation.isNonBlocking()) { + return msg; + } + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){ msg = invokeResponse(msg); } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java index 6c0e238926..759de6ef62 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java @@ -18,18 +18,15 @@ */ package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime; -import javax.jms.JMSException; import javax.jms.Session; -import org.apache.tuscany.sca.assembly.WireFormat; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -65,6 +62,12 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor { msg = getNext().invoke(msg); + //if it's oneway return back + Operation operation = msg.getOperation(); + if (operation != null && operation.isNonBlocking()) { + return msg; + } + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSObject){ msg = invokeResponse(msg); } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java index 0d75f259c3..cf9e49afef 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java @@ -18,18 +18,15 @@ */ package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime; -import javax.jms.JMSException; import javax.jms.Session; -import org.apache.tuscany.sca.assembly.WireFormat; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -65,6 +62,12 @@ public class WireFormatJMSTextServiceInterceptor implements Interceptor { msg = getNext().invoke(msg); + //if it's oneway return back + Operation operation = msg.getOperation(); + if (operation != null && operation.isNonBlocking()) { + return msg; + } + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){ msg = invokeResponse(msg); } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java index 02508084ca..9236055542 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java @@ -18,19 +18,15 @@ */ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime; -import javax.jms.JMSException; import javax.jms.Session; -import javax.naming.NamingException; -import org.apache.tuscany.sca.assembly.WireFormat; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; +import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -67,6 +63,12 @@ public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor { msg = getNext().invoke(msg); + //if it's oneway return back + Operation operation = msg.getOperation(); + if (operation != null && operation.isNonBlocking()) { + return msg; + } + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSTextXML){ msg = invokeResponse(msg); } |