activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6290
Date Wed, 11 May 2016 20:03:41 GMT
Repository: activemq
Updated Branches:
  refs/heads/master e53e34026 -> 2e64abc38


https://issues.apache.org/jira/browse/AMQ-6290

Close failed connection on start if the reconnect on exception flag is
enabled.  

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/2e64abc3
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/2e64abc3
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/2e64abc3

Branch: refs/heads/master
Commit: 2e64abc38a0605f31fc47a89c8313f29cc72c170
Parents: e53e340
Author: Timothy Bish <tabish121@gmail.com>
Authored: Wed May 11 16:03:19 2016 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed May 11 16:03:19 2016 -0400

----------------------------------------------------------------------
 .../apache/activemq/jms/pool/ConnectionPool.java   |  3 +++
 .../PooledConnectionSecurityExceptionTest.java     | 17 +++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/2e64abc3/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java
b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java
index 2be4a6f..a449f9f 100644
--- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java
+++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java
@@ -125,6 +125,9 @@ public class ConnectionPool implements ExceptionListener {
                 connection.start();
             } catch (JMSException e) {
                 started.set(false);
+                if (isReconnectOnException()) {
+                    close();
+                }
                 throw(e);
             }
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/2e64abc3/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
index 3a8eb27..a2338ed 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
@@ -106,7 +106,16 @@ public class PooledConnectionSecurityExceptionTest {
     }
 
     @Test
+    public void testFailureGetsNewConnectionOnRetryLooped() throws Exception {
+        for (int i = 0; i < 10; ++i) {
+            testFailureGetsNewConnectionOnRetry();
+        }
+    }
+
+    @Test
     public void testFailureGetsNewConnectionOnRetry() throws Exception {
+        pooledConnFact.setMaxConnections(1);
+
         final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid",
"credentials");
 
         try {
@@ -122,19 +131,19 @@ public class PooledConnectionSecurityExceptionTest {
             @Override
             public boolean isSatisified() throws Exception {
                 return connection1.getConnection() !=
-                          ((PooledConnection) pooledConnFact.createConnection("invalid",
"credentials")).getConnection();
+                    ((PooledConnection) pooledConnFact.createConnection("invalid", "credentials")).getConnection();
             }
         }));
 
-        PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid",
"credentials");
+        final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid",
"credentials");
+        assertNotSame(connection1.getConnection(), connection2.getConnection());
+
         try {
             connection2.start();
             fail("Should fail to connect");
         } catch (JMSSecurityException ex) {
             LOG.info("Caught expected security error");
         }
-
-        assertNotSame(connection1.getConnection(), connection2.getConnection());
     }
 
     @Test


Mime
View raw message