diff options
Diffstat (limited to 'branches/sca-java-1.x')
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) { |