summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-22 17:36:30 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-22 17:36:30 +0000
commit3f20ac3296bdc03b6e43b2c93e3900ba83665deb (patch)
tree30763fbe717cba61fad939540b62588537f3f1d9
parentf2aa783fb2127a8a8256815d8d890a8a7813924f (diff)
Merge TUSCANY-3057 JMS fix from 1.x to 1.5
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@777632 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-java-1.5/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java4
-rw-r--r--branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java5
-rw-r--r--branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java16
-rw-r--r--branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java4
4 files changed, 17 insertions, 12 deletions
diff --git a/branches/sca-java-1.5/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/branches/sca-java-1.5/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
index ee9602de35..de16edb044 100644
--- a/branches/sca-java-1.5/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
+++ b/branches/sca-java-1.5/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
@@ -220,5 +220,9 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
public MessageFactory getMessageFactory() {
return messageFactory;
}
+
+ public JMSResourceFactory getResourceFactory() {
+ return jmsResourceFactory;
+ }
}
diff --git a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java
index 3e452af052..77c121bedc 100644
--- a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java
+++ b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java
@@ -60,13 +60,13 @@ public class ASFListener implements JMSServiceListener {
private Destination destination;
- public ASFListener(MessageListener listener, String serviceName, boolean isCallbackService, JMSBinding jmsBinding, WorkScheduler workScheduler) {
+ public ASFListener(MessageListener listener, String serviceName, boolean isCallbackService, JMSBinding jmsBinding, WorkScheduler workScheduler, JMSResourceFactory rf) {
this.listener = listener;
this.serviceName = serviceName;
this.isCallbackService = isCallbackService;
this.jmsBinding = jmsBinding;
this.workScheduler = workScheduler;
- this.jmsResourceFactory = new JMSResourceFactoryImpl(jmsBinding.getConnectionFactoryName(), jmsBinding.getResponseConnectionFactoryName(), jmsBinding.getInitialContextFactoryName(), jmsBinding.getJndiURL());
+ this.jmsResourceFactory = rf;
}
public void start() {
@@ -84,6 +84,7 @@ public class ASFListener implements JMSServiceListener {
try {
consumer.close();
jmsResourceFactory.closeConnection();
+ jmsResourceFactory.closeResponseConnection();
} catch (Exception e) {
// if using an embedded broker then when shutting down Tuscany the broker may get closed
// before this stop method is called. I can't see how to detect that so for now just
diff --git a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java
index 495f046eca..16cfb545e2 100644
--- a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java
+++ b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java
@@ -22,10 +22,11 @@ package org.apache.tuscany.sca.host.jms.asf;
import javax.jms.MessageListener;
import javax.naming.NamingException;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerDetails;
+import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.host.jms.JMSServiceListener;
+import org.apache.tuscany.sca.host.jms.JMSServiceListenerDetails;
import org.apache.tuscany.sca.host.jms.JMSServiceListenerFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.work.WorkScheduler;
@@ -38,16 +39,15 @@ public class JMSServiceListenerFactoryImpl implements JMSServiceListenerFactory
this.workScheduler = workScheduler;
}
- public JMSServiceListener createJMSServiceListener(String serviceName, boolean isCallbackService, JMSBinding jmsBinding, MessageListener listener) {
- return new ASFListener(listener, serviceName, isCallbackService, jmsBinding, workScheduler);
- }
-
public JMSServiceListener createJMSServiceListener(JMSServiceListenerDetails jmsSLD) {
try {
- MessageListener listener = new ServiceInvoker(jmsSLD.getJmsBinding(), jmsSLD.getService(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory());
+ JMSResourceFactory rf = ((JMSBindingServiceBindingProvider)jmsSLD).getResourceFactory();
+
+ MessageListener listener = new ServiceInvoker(jmsSLD.getJmsBinding(), jmsSLD.getService(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
RuntimeComponentService service = jmsSLD.getService();
- return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler);
+
+ return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
} catch (NamingException e) {
throw new JMSBindingException(e);
diff --git a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java
index 75781570c0..45c47c7129 100644
--- a/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java
+++ b/branches/sca-java-1.5/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java
@@ -55,9 +55,9 @@ public class ServiceInvoker implements MessageListener {
private RuntimeComponentService service;
private MessageFactory messageFactory;
- public ServiceInvoker(JMSBinding jmsBinding, RuntimeComponentService service, Binding targetBinding, MessageFactory messageFactory) throws NamingException {
+ public ServiceInvoker(JMSBinding jmsBinding, RuntimeComponentService service, Binding targetBinding, MessageFactory messageFactory, JMSResourceFactory rf) throws NamingException {
this.jmsBinding = jmsBinding;
- this.jmsResourceFactory = new JMSResourceFactoryImpl(jmsBinding.getConnectionFactoryName(), jmsBinding.getResponseConnectionFactoryName(), jmsBinding.getInitialContextFactoryName(), jmsBinding.getJndiURL());
+ this.jmsResourceFactory = rf;
this.service = service;
this.targetBinding = targetBinding;
this.messageFactory = messageFactory;