activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [09/10] git commit: AMQ-4826: Failover transport - avoid floating-point issue on other JDKs.
Date Wed, 12 Mar 2014 12:35:54 GMT
AMQ-4826: Failover transport - avoid floating-point issue on other JDKs.


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

Branch: refs/heads/activemq-5.9
Commit: a097fb5486a621f58d6cf53146b031967b294afe
Parents: 6724c88
Author: Claus Ibsen <claus.ibsen@gmail.com>
Authored: Sun Nov 3 11:00:03 2013 +0100
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Wed Mar 12 08:32:39 2014 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/transport/failover/FailoverTransport.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/a097fb54/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
index fc81f94..9a524df 100755
--- a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
+++ b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
@@ -776,7 +776,8 @@ public class FailoverTransport implements CompositeTransport {
         if (randomize) {
             // Randomly, reorder the list by random swapping
             for (int i = 0; i < l.size(); i++) {
-                int p = (int) (Math.random() * 100 % l.size());
+                // meed parenthesis due other JDKs (see AMQ-4826)
+                int p = ((int) (Math.random() * 100)) % l.size();
                 URI t = l.get(p);
                 l.set(p, l.get(i));
                 l.set(i, t);


Mime
View raw message