activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r451323 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq: ActiveMQConnection.java ActiveMQSession.java
Date Fri, 29 Sep 2006 15:10:29 GMT
Author: jstrachan
Date: Fri Sep 29 08:10:28 2006
New Revision: 451323

URL: http://svn.apache.org/viewvc?view=rev&rev=451323
Log:
make absolutely sure that a session is always removed from the connection even if there is
a failure while closing

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?view=diff&rev=451323&r1=451322&r2=451323
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Fri Sep 29 08:10:28 2006
@@ -165,9 +165,7 @@
      * Construct an <code>ActiveMQConnection</code>
      * @param transport 
      * @param factoryStats
-     * @param userName
-     * @param password
-     * @throws Exception 
+     * @throws Exception
      */
     protected ActiveMQConnection(final Transport transport, IdGenerator clientIdGenerator,
JMSStatsImpl factoryStats)
             throws Exception {

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java?view=diff&rev=451323&r1=451322&r2=451323
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java
Fri Sep 29 08:10:28 2006
@@ -535,32 +535,36 @@
     synchronized public void dispose() throws JMSException {
         if (!closed) {
 
-            executor.stop();
-            
-            for (Iterator iter = consumers.iterator(); iter.hasNext();) {
-                ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) iter.next();
-                consumer.dispose();
-            }
-            consumers.clear();
-
-            for (Iterator iter = producers.iterator(); iter.hasNext();) {
-                ActiveMQMessageProducer producer = (ActiveMQMessageProducer) iter.next();
-                producer.dispose();
-            }
-            producers.clear();
-            
             try {
-                if (getTransactionContext().isInLocalTransaction()) {
-                    rollback();
+                executor.stop();
+
+                for (Iterator iter = consumers.iterator(); iter.hasNext();) {
+                    ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) iter.next();
+                    consumer.dispose();
+                }
+                consumers.clear();
+
+                for (Iterator iter = producers.iterator(); iter.hasNext();) {
+                    ActiveMQMessageProducer producer = (ActiveMQMessageProducer) iter.next();
+                    producer.dispose();
                 }
-            } catch (JMSException e) {
+                producers.clear();
+
+                try {
+                    if (getTransactionContext().isInLocalTransaction()) {
+                        rollback();
+                    }
+                }
+                catch (JMSException e) {
+                }
+
+
+            }
+            finally {
+                connection.removeSession(this);
+                this.transactionContext = null;
+                closed = true;
             }
-            
-            
-            connection.removeSession(this);
-            this.transactionContext=null;
-            closed = true;
-            
         }
     }
 



Mime
View raw message