summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jms-runtime/src
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-12 12:50:36 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-12 12:50:36 +0000
commitc3f14ef336a1fef26b80600a381697f90dfb988f (patch)
tree88fb79cdd447186e1775589d7816b6cb14eadcb0 /branches/sca-java-1.x/modules/binding-jms-runtime/src
parente869ce8b1c252fc277385edbd6c98ff1c8a0470f (diff)
TUSCANY-2839: Start at supporting services invoked by oneway requests not needing a response connection factory
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@743710 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime/src')
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java26
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java7
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java7
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java2
8 files changed, 32 insertions, 18 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
index 6370c9f575..183e006b04 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
@@ -19,9 +19,12 @@
package org.apache.tuscany.sca.binding.jms.context;
import javax.jms.Destination;
+import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
+import javax.naming.NamingException;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
@@ -34,6 +37,7 @@ public class JMSBindingContext {
private Message jmsMsg;
private Session jmsSession;
+ private Session jmsResponseSession;
private Destination requestDestination;
private Destination replyToDestination;
private JMSResourceFactory jmsResourceFactory;
@@ -47,12 +51,26 @@ public class JMSBindingContext {
this.jmsMsg = jmsMsg;
}
- public Session getJmsSession() {
+ public synchronized Session getJmsSession() {
+ if (jmsSession == null) {
+ try {
+ jmsSession = getJmsResourceFactory().createSession();
+ } catch (Exception e) {
+ throw new JMSBindingException(e);
+ }
+ }
return jmsSession;
}
-
- public void setJmsSession(Session jmsSession) {
- this.jmsSession = jmsSession;
+
+ public synchronized Session getJmsResponseSession() {
+ if (jmsResponseSession == null) {
+ try {
+ jmsResponseSession = getJmsResourceFactory().createResponseSession();
+ } catch (Exception e) {
+ throw new JMSBindingException(e);
+ }
+ }
+ return jmsResponseSession;
}
public Destination getRequestDestination() {
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
index a4cc79426e..db9b90c7eb 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
@@ -186,14 +186,13 @@ public class RRBJMSBindingInvoker implements Invoker, DataExchangeSemantics {
public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message tuscanyMsg) {
try {
- // create a jms session to cover the creation and sending of the message
- Session session = jmsResourceFactory.createSession();
-
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
tuscanyMsg.setBindingContext(context);
- context.setJmsSession(session);
+ // get a jms session to cover the creation and sending of the message
+ Session session = context.getJmsSession();
+
context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
context.setReplyToDestination(getReplyToDestination(session));
context.setJmsResourceFactory(jmsResourceFactory);
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
index 62b51bd797..20ee4c8942 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
@@ -105,7 +105,7 @@ public class TransportReferenceInterceptor implements Interceptor {
try {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message requestMessage = (javax.jms.Message)msg.getBody();
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 2ac476ea82..5012c24b65 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
@@ -79,7 +79,7 @@ public class TransportServiceInterceptor implements Interceptor {
} catch (Throwable e) {
logger.log(Level.SEVERE, "Exception invoking service '" + service.getName(), e);
JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message replyJMSMsg = responseMessageProcessor.createFaultMessage(context.getJmsSession(),
+ javax.jms.Message replyJMSMsg = responseMessageProcessor.createFaultMessage(context.getJmsResponseSession(),
(Throwable)e);
msg.setBody(replyJMSMsg);
invokeResponse(msg);
@@ -91,7 +91,6 @@ public class TransportServiceInterceptor implements Interceptor {
try {
JMSBindingContext context = msg.getBindingContext();
javax.jms.Message requestJMSMsg = context.getJmsMsg();
- context.setJmsSession(context.getJmsResourceFactory().createResponseSession());
EndpointReference from = new EndpointReferenceImpl(null);
msg.setFrom(from);
@@ -106,15 +105,13 @@ public class TransportServiceInterceptor implements Interceptor {
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
- } catch (NamingException e) {
- throw new JMSBindingException(e);
}
}
public Message invokeResponse(Message msg) {
try {
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message requestJMSMsg = context.getJmsMsg();
javax.jms.Message responseJMSMsg = msg.getBody();
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 38d5a40012..8aabe1f510 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
@@ -86,7 +86,7 @@ public class WireFormatJMSBytesServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
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 f4eaa78eec..6c0e238926 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
@@ -91,7 +91,7 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg = null;
if (msg.isFault()) {
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 53d41066e8..0d75f259c3 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
@@ -86,7 +86,7 @@ public class WireFormatJMSTextServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
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 baa0d2ee23..02508084ca 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
@@ -93,7 +93,7 @@ public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
+ Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {