diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-22 17:29:55 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-22 17:29:55 +0000 |
commit | f2aa783fb2127a8a8256815d8d890a8a7813924f (patch) | |
tree | 421f1ba33d8203653f6739cc214e5e33ecbae7be /branches/sca-java-1.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf | |
parent | bbbda66efd636e9f08fff420d713dd19f8d19673 (diff) |
TUSCANY-3057: fix to use single JMS resource factory for request and response
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@777627 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf')
3 files changed, 13 insertions, 12 deletions
diff --git a/branches/sca-java-1.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java b/branches/sca-java-1.x/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.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java +++ b/branches/sca-java-1.x/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.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java b/branches/sca-java-1.x/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.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java +++ b/branches/sca-java-1.x/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.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java b/branches/sca-java-1.x/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.x/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java +++ b/branches/sca-java-1.x/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;
|