diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-07 11:16:38 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-07 11:16:38 +0000 |
commit | 033cd11fd3fe44118165b5fcc15eae9f841bd9ac (patch) | |
tree | 65aad787ef5c18b70c924c6ca82c19c14323af97 | |
parent | 4b28dd00da8c6dc2f544d189979fcc61d43da79d (diff) |
TUSCANY-3255: Apply patch from Greg Dritschler to Consolidate JMS session management in JMSResourceFactory
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@812082 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
3 files changed, 18 insertions, 2 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 64c07dbae3..677f8eb6f8 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 @@ -66,7 +66,7 @@ public class JMSBindingContext { public synchronized void closeJmsSession() { if (jmsSession != null) { try { - jmsSession.close(); + getJmsResourceFactory().closeSession(jmsSession); } catch (Exception e) { throw new JMSBindingException(e); } finally { @@ -89,7 +89,7 @@ public class JMSBindingContext { public synchronized void closeJmsResponseSession() { if (jmsResponseSession != null) { try { - jmsResponseSession.close(); + getJmsResourceFactory().closeResponseSession(jmsResponseSession); } catch (Exception e) { throw new JMSBindingException(e); } finally { diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java index 7062d0455d..348764fe43 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java @@ -43,6 +43,8 @@ public interface JMSResourceFactory { */
public abstract Session createSession() throws JMSException, NamingException;
+ public abstract void closeSession(Session session) throws JMSException;
+
/*
* (non-Javadoc)
*
@@ -80,6 +82,7 @@ public interface JMSResourceFactory { */
public abstract Session createResponseSession() throws JMSException, NamingException;
+ public abstract void closeResponseSession(Session session) throws JMSException;
public abstract void closeResponseConnection() throws JMSException;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java index 5e9cce0c98..1debc61dff 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java @@ -89,6 +89,15 @@ public class JMSResourceFactoryImpl implements JMSResourceFactory { /* * (non-Javadoc) * + * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#closeSession(javax.jms.Session) + */ + public void closeSession(Session session) throws JMSException { + session.close(); + } + + /* + * (non-Javadoc) + * * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#startConnection() */ public void startConnection() throws JMSException, NamingException { @@ -229,6 +238,10 @@ public class JMSResourceFactoryImpl implements JMSResourceFactory { return getResponseConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); } + public void closeResponseSession(Session session) throws JMSException { + session.close(); + } + public Connection getResponseConnection() throws NamingException, JMSException { if (responseConnection == null) { if (responseConnectionFactoryName != null) { |