[jboss-svn-commits] JBL Code SVN: r10103 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 9 17:28:44 EST 2007


Author: kurt.stam at jboss.com
Date: 2007-03-09 17:28:44 -0500 (Fri, 09 Mar 2007)
New Revision: 10103

Modified:
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
Log:
Closing the JNDI connection.

Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2007-03-09 20:48:00 UTC (rev 10102)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2007-03-09 22:28:44 UTC (rev 10103)
@@ -238,6 +238,7 @@
 	private void createMessageProducer () throws CourierException,
 			MalformedEPRException
 	{
+        Context oJndiCtx = null;
 		try
 		{
 			String sJndiConnectionFactory = _epr.getJndiContextFactory();
@@ -249,7 +250,7 @@
 			String sJndiPkgPrefix = _epr.getJndiPkgPrefix();
 			if (Util.isNullString(sJndiPkgPrefix))
 				sJndiPkgPrefix = NamingContext.JBOSS_URL_PKG_PREFIX;
-			Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
+			oJndiCtx = NamingContext.getServerContext(sJndiURL,
 					sJndiConnectionFactory, sJndiPkgPrefix);
 
 			String sFactoryClass = _epr.getConnectionFactory();
@@ -320,6 +321,16 @@
 		{
 			throw new MalformedEPRException(ex);
 		}
+        finally {
+            if (oJndiCtx!=null) {
+                try {
+                    oJndiCtx.close();
+                } catch (NamingException ne) {
+                    _logger.error(ne.getMessage(), ne);
+                }
+            }
+           
+        }
 
 	} // ________________________________
 
@@ -406,6 +417,7 @@
 
 	private void createMessageConsumer () throws CourierException, ConfigurationException, MalformedEPRException
 	{
+        Context oJndiCtx = null;
 		try
 		{
 			String sJndiConnectionFactory = _epr.getJndiContextFactory();
@@ -417,7 +429,7 @@
 			String sJndiPkgPrefix = _epr.getJndiPkgPrefix();
 			if (Util.isNullString(sJndiPkgPrefix))
 				sJndiPkgPrefix = NamingContext.JBOSS_URL_PKG_PREFIX;
-			Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
+			oJndiCtx = NamingContext.getServerContext(sJndiURL,
 					sJndiConnectionFactory, sJndiPkgPrefix);
 			if (null == oJndiCtx)
 				throw new ConfigurationException(
@@ -486,6 +498,16 @@
 		{
 			throw new MalformedEPRException(ex);
 		}
+        finally {
+            if (oJndiCtx!=null) {
+                try {
+                    oJndiCtx.close();
+                } catch (NamingException ne) {
+                    _logger.error(ne.getMessage(), ne);
+                }
+            }
+           
+        }
 
 	} // ________________________________
 	




More information about the jboss-svn-commits mailing list