You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by da...@apache.org on 2013/11/03 10:59:32 UTC
git commit: AMQ-4826: Failover transport - avoid floating-point issue
on other JDKs.
Updated Branches:
refs/heads/trunk a6c14b418 -> 06356db1c
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/06356db1
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/06356db1
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/06356db1
Branch: refs/heads/trunk
Commit: 06356db1c4dda514be086961a891aff8765c63be
Parents: a6c14b4
Author: Claus Ibsen <cl...@gmail.com>
Authored: Sun Nov 3 11:00:03 2013 +0100
Committer: Claus Ibsen <cl...@gmail.com>
Committed: Sun Nov 3 11:00:03 2013 +0100
----------------------------------------------------------------------
.../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/06356db1/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);