You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ha...@apache.org on 2014/03/12 13:35:54 UTC
[09/10] git commit: AMQ-4826: Failover transport - avoid
floating-point issue on other JDKs.
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 <cl...@gmail.com>
Authored: Sun Nov 3 11:00:03 2013 +0100
Committer: Hadrian Zbarcea <ha...@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);