You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2011/12/03 08:15:12 UTC

svn commit: r1209841 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java

Author: rajdavies
Date: Sat Dec  3 07:15:12 2011
New Revision: 1209841

URL: http://svn.apache.org/viewvc?rev=1209841&view=rev
Log:
Only stop transport for java.lang.SecurityException - as some tests rely on Connection continung after an exception from the broker

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?rev=1209841&r1=1209840&r2=1209841&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java Sat Dec  3 07:15:12 2011
@@ -1307,13 +1307,15 @@ public class ActiveMQConnection implemen
                         }catch(Throwable e) {
                             LOG.error("Caught an exception trying to create a JMSException for " +er.getException(),e);
                         }
-                        //dispose of transport
-                        Transport t = this.transport;
-                        if (null != t){
-                            ServiceSupport.dispose(t);
-                        }
-                        if(jmsEx !=null) {
-                            throw jmsEx;
+                        //dispose of transport for security exceptions
+                        if (er.getException() instanceof SecurityException){
+                            Transport t = this.transport;
+                            if (null != t){
+                                ServiceSupport.dispose(t);
+                            }
+                            if(jmsEx !=null) {
+                                throw jmsEx;
+                            }
                         }
                     }
                 }
@@ -1521,8 +1523,9 @@ public class ActiveMQConnection implemen
     }
 
     public void finalize() throws Throwable{
-        if (scheduler != null){
-            scheduler.stop();
+        Scheduler s = this.scheduler;
+        if (s != null){
+            s.stop();
         }
     }
 
@@ -2473,5 +2476,4 @@ public class ActiveMQConnection implemen
             }
         }
     }
-
 }