Repository: qpid-jms
Updated Branches:
  refs/heads/master 6295f7e6b -> 44be741f5


QPIDJMS-267: fix synchronization on addAll, update tests and docs a little


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/44be741f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/44be741f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/44be741f

Branch: refs/heads/master
Commit: 44be741f53b2567fd96a8184d862584a7b6b0940
Parents: 6295f7e
Author: Robert Gemmell <[email protected]>
Authored: Mon Feb 27 12:01:57 2017 +0000
Committer: Robert Gemmell <[email protected]>
Committed: Mon Feb 27 12:01:57 2017 +0000

----------------------------------------------------------------------
 .../jms/provider/failover/FailoverUriPool.java  | 12 ++++++------
 .../provider/failover/FailoverUriPoolTest.java  |  4 ++++
 ...qpOpenProvidedServerListIntegrationTest.java | 20 +++++++++-----------
 qpid-jms-docs/Configuration.md                  |  4 ++--
 4 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44be741f/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverUriPool.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverUriPool.java
 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverUriPool.java
index 3740da6..2227141 100644
--- 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverUriPool.java
+++ 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverUriPool.java
@@ -167,19 +167,19 @@ public class FailoverUriPool {
     }
 
     /**
-     * Adds a new URI to the pool if not already contained within.  The URI 
will have
-     * any nest options that have been configured added to its existing set of 
options.
+     * Adds a list of new URIs to the pool if not already contained within.  
The URIs will have
+     * any nest options that have been configured added to their existing set 
of options.
      *
-     * @param uris
+     * @param additions
      *        The new list of URIs to add to the pool.
      */
-    public void addAll(List<URI> uris) {
-        if (uris == null || uris.isEmpty()) {
+    public void addAll(List<URI> additions) {
+        if (additions == null || additions.isEmpty()) {
             return;
         }
 
         synchronized (uris) {
-            for (URI uri : uris) {
+            for (URI uri : additions) {
                 add(uri);
             }
         }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44be741f/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
index b59e1b6..0ff0942 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
@@ -321,6 +321,10 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
     public void testAddAll() throws URISyntaxException {
         FailoverUriPool pool = new FailoverUriPool(null, null);
         pool.setRandomize(false);
+
+        assertEquals(0, pool.size());
+        assertFalse(uris.isEmpty());
+
         pool.addAll(uris);
 
         assertEquals(uris.size(), pool.size());

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44be741f/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverWithAmqpOpenProvidedServerListIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverWithAmqpOpenProvidedServerListIntegrationTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverWithAmqpOpenProvidedServerListIntegrationTest.java
index bdfa3e5..4f6e70b 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverWithAmqpOpenProvidedServerListIntegrationTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverWithAmqpOpenProvidedServerListIntegrationTest.java
@@ -476,7 +476,7 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertFailoverURIList(connection, afterOpenFailoverURIs);
 
-            // Verify the client fails over to the advertised backup, and uses 
the correct AMQP hostname when doing so
+            // Verify the client fails over to the advertised backup
             backupPeer.expectSaslAnonymous();
             backupPeer.expectOpen();
             backupPeer.expectBegin();
@@ -586,8 +586,7 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertFailoverURIList(connection, afterOpenFailoverURIs);
 
-            // Verify the client fails over to the advertised backup, and uses
-            // the correct AMQP hostname when doing so
+            // Verify the client fails over to the advertised backup
             backupPeer.expectSaslAnonymous();
             backupPeer.expectOpen();
             backupPeer.expectBegin();
@@ -698,8 +697,7 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertFailoverURIList(connection, afterOpenFailoverURIs);
 
-            // Verify the client fails over to the advertised backup, and uses
-            // the correct AMQP hostname when doing so
+            // Verify the client fails over to the advertised backup
             backupPeer.expectSaslAnonymous();
             backupPeer.expectOpen();
             backupPeer.expectBegin();
@@ -815,8 +813,7 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertFailoverURIList(connection, afterOpenFailoverURIs);
 
-            // Verify the client fails over to the advertised backup, and uses
-            // the correct AMQP hostname when doing so
+            // Verify the client fails over to the advertised backup
             backupPeer.expectSaslAnonymous();
             backupPeer.expectOpen();
             backupPeer.expectBegin();
@@ -924,7 +921,8 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertTrue("Should connect to primary peer", 
connectedToPrimary.await(5, TimeUnit.SECONDS));
 
-            // Verify the failover URIs are as expected, now containing 
initial peer and the backup1
+            // Verify the failover URIs are as expected, now containing 
initial peer and if non-secure redirect
+            // was permitted, the non-secure backup as well.
             List<URI> afterOpenFailoverURIs = new ArrayList<>();
             afterOpenFailoverURIs.add(new URI(primaryPeerURI + "?" + 
connectionOptions));
             if (allow) {
@@ -951,8 +949,8 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
     /*
      * Verify that when the Open frame contains a failover server list and we 
are connected via
-     * the 'amqp' transport and the redirect contains a 'ws' scheme that 
failover reconnect list
-     * is updated to contain the 'amqpws' redirect.
+     * the 'amqp' transport and the redirect contains a 'wss' scheme that 
failover reconnect list
+     * is updated to contain the 'amqpwss' redirect.
      */
     @Test(timeout = 20000)
     public void testFailoverAcceptsUpdateUsingTransportSchemeWSS() throws 
Exception {
@@ -1031,7 +1029,7 @@ public class 
FailoverWithAmqpOpenProvidedServerListIntegrationTest extends QpidJ
 
             assertTrue("Should connect to primary peer", 
connectedToPrimary.await(5, TimeUnit.SECONDS));
 
-            // Verify the failover URIs are as expected, now containing 
initial peer and the backup1
+            // Verify the failover URIs are as expected, containing initial 
peer and a backup with expected uri scheme.
             List<URI> afterOpenFailoverURIs = new ArrayList<>();
             afterOpenFailoverURIs.add(new URI(primaryPeerURI + "?" + 
connectionOptions));
             afterOpenFailoverURIs.add(new URI(expected + "://localhost:5673?" 
+ connectionOptions));

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44be741f/qpid-jms-docs/Configuration.md
----------------------------------------------------------------------
diff --git a/qpid-jms-docs/Configuration.md b/qpid-jms-docs/Configuration.md
index f6711bb..f44c89c 100644
--- a/qpid-jms-docs/Configuration.md
+++ b/qpid-jms-docs/Configuration.md
@@ -202,7 +202,7 @@ These options apply to the behaviour of certain AMQP 
functionality.
 
 ### Failover Configuration options
 
-With failover enabled the client can reconnect to a different broker 
automatically when the connection to the current connection is lost for some 
reason.  The failover URI is always initiated with the *failover* prefix and a 
list of URIs for the brokers is contained inside a set of parentheses. The 
"jms." options are applied to the overall failover URI, outside the 
parentheses, and affect the JMS Connection object for its lifetime.
+With failover enabled the client can reconnect to another server automatically 
when connection to the current server is lost for some reason.  The failover 
URI is always initiated with the *failover* prefix and a list of URIs for the 
server(s) is contained inside a set of parentheses. The "jms." options are 
applied to the overall failover URI, outside the parentheses, and affect the 
JMS Connection object for its lifetime.
 
 The URI for failover looks something like the following:
 
@@ -223,7 +223,7 @@ The complete set of configuration options for failover is 
listed below:
 + **failover.startupMaxReconnectAttempts** For a client that has never 
connected to a remote peer before this option control how many attempts are 
made to connect before reporting the connection as failed.  The default is to 
use the value of maxReconnectAttempts.
 + **failover.warnAfterReconnectAttempts** Controls how often the client will 
log a message indicating that failover reconnection is being attempted.  The 
default is to log every 10 connection attempts.
 + **failover.randomize** When true the set of failover URIs is randomly 
shuffled prior to attempting to connect to one of them.  This can help to 
distribute client connections more evenly across multiple remote peers.  The 
default value is false.
-+ **failover.amqpOpenServerListBehaviour** Controls how the failover transport 
behaves when the Open frame of the remote connection provides a list of 
failover hosts to the client.  This option accepts one of three values; 
REPLACE, ADD, or IGNORE (default is REPLACE).  If replacement is configured 
than all failover URIs other than the one for the current connection are 
replaced with those provided by the remote peer.  If ADD is configured then the 
URIs provided by the remote are added to the existing set of failover URIs.  If 
IGNORE is configured than any updates from the remote are dropped and no 
updates are made the the set of failover URIs.
++ **failover.amqpOpenServerListBehaviour** Controls how the failover transport 
behaves when the connection Open frame from the remote peer provides a list of 
failover hosts to the client.  This option accepts one of three values; 
REPLACE, ADD, or IGNORE (default is REPLACE).  If REPLACE is configured then 
all failover URIs other than the one for the current server are replaced with 
those provided by the remote peer.  If ADD is configured then the URIs provided 
by the remote are added to the existing set of failover URIs, with 
de-duplication.  If IGNORE is configured than any updates from the remote are 
dropped and no changes are made the the set of failover URIs in use.
 
 The failover URI also supports defining 'nested' options as a means of 
specifying AMQP and transport option values applicable to all the individual 
nested broker URI's, which can be useful to avoid repetition. This is 
accomplished using the same "transport." and "amqp." URI options outlined 
earlier for a non-failover broker URI but prefixed with *failover.nested.*. For 
example, to apply the same value for the *amqp.vhost* option to every broker 
connected to you might have a URI like:
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to