activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r423797 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Date Thu, 20 Jul 2006 06:13:43 GMT
Author: jstrachan
Date: Wed Jul 19 23:13:43 2006
New Revision: 423797

URL: http://svn.apache.org/viewvc?rev=423797&view=rev
Log:
added patch for AMQ-835 - many thanks Ozgur Cetinturk

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.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?rev=423797&r1=423796&r2=423797&view=diff
==============================================================================
--- 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
Wed Jul 19 23:13:43 2006
@@ -529,52 +529,56 @@
     public void close() throws JMSException {
         checkClosed();
 
-        // If we were running, lets stop first.
-        stop();
+        try {
+            // If we were running, lets stop first.
+            stop();
+
+            synchronized (this) {
+                if (!closed.get()) {
+                    closing.set(true);
+
+                    if (advisoryConsumer != null) {
+                        advisoryConsumer.dispose();
+                        advisoryConsumer = null;
+                    }
+
+                    for (Iterator i = this.sessions.iterator(); i.hasNext();) {
+                        ActiveMQSession s = (ActiveMQSession) i.next();
+                        s.dispose();
+                    }
+                    for (Iterator i = this.connectionConsumers.iterator(); i.hasNext();)
{
+                        ActiveMQConnectionConsumer c = (ActiveMQConnectionConsumer) i.next();
+                        c.dispose();
+                    }
+                    for (Iterator i = this.inputStreams.iterator(); i.hasNext();) {
+                        ActiveMQInputStream c = (ActiveMQInputStream) i.next();
+                        c.dispose();
+                    }
+                    for (Iterator i = this.outputStreams.iterator(); i.hasNext();) {
+                        ActiveMQOutputStream c = (ActiveMQOutputStream) i.next();
+                        c.dispose();
+                    }
+
+                    if (isConnectionInfoSentToBroker) {
+                        syncSendPacket(info.createRemoveCommand(), closeTimeout);
+                    }
+
+                    asyncSendPacket(new ShutdownInfo());
+                    ServiceSupport.dispose(this.transport);
+
+                    started.set(false);
+
+                    // TODO : ActiveMQConnectionFactory.onConnectionClose() not
+                    // yet implemented.
+                    // factory.onConnectionClose(this);
 
-        synchronized (this) {
-            if (!closed.get()) {
-                closing.set(true);
-
-                if( advisoryConsumer!=null ) {
-                    advisoryConsumer.dispose();
-                    advisoryConsumer=null;
+                    closed.set(true);
+                    closing.set(false);
                 }
-
-                for (Iterator i = this.sessions.iterator(); i.hasNext();) {
-                    ActiveMQSession s = (ActiveMQSession) i.next();
-                    s.dispose();
-                }
-                for (Iterator i = this.connectionConsumers.iterator(); i.hasNext();) {
-                    ActiveMQConnectionConsumer c = (ActiveMQConnectionConsumer) i.next();
-                    c.dispose();
-                }
-                for (Iterator i = this.inputStreams.iterator(); i.hasNext();) {
-                    ActiveMQInputStream c = (ActiveMQInputStream) i.next();
-                    c.dispose();
-                }
-                for (Iterator i = this.outputStreams.iterator(); i.hasNext();) {
-                    ActiveMQOutputStream c = (ActiveMQOutputStream) i.next();
-                    c.dispose();
-                }
-                
-                
-                if (isConnectionInfoSentToBroker) {
-                    syncSendPacket(info.createRemoveCommand(),closeTimeout);
-                }
-
-                asyncSendPacket(new ShutdownInfo());
-                ServiceSupport.dispose(this.transport);
-
-                started.set(false);
-
-                // TODO : ActiveMQConnectionFactory.onConnectionClose() not
-                // yet implemented.
-                // factory.onConnectionClose(this);
-                
-                closed.set(true);
-                closing.set(false);
             }
+        }
+        finally {
+            factoryStats.removeConnection(this);
         }
     }
 



Mime
View raw message