diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-07 11:17:33 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-07 11:17:33 +0000 |
commit | fa8eea2b8ef864dcdf98d6296083e34bb3deb9f3 (patch) | |
tree | 1ade87f456615c5d11dc8b174ad572c8c1d30c28 /branches/sca-java-1.5.1/modules/binding-jms-runtime/src | |
parent | 033cd11fd3fe44118165b5fcc15eae9f841bd9ac (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@812084 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/modules/binding-jms-runtime/src')
3 files changed, 18 insertions, 2 deletions
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/branches/sca-java-1.5.1/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.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java +++ b/branches/sca-java-1.5.1/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.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/branches/sca-java-1.5.1/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.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java +++ b/branches/sca-java-1.5.1/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.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/branches/sca-java-1.5.1/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.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java +++ b/branches/sca-java-1.5.1/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) { |