activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Kettelerij <richardkettele...@gmail.com>
Subject Re: Transport Options (Randomize algorithm)
Date Tue, 21 Jan 2014 15:01:04 GMT
Here's the implementation of ?randomize=true. Source
https://github.com/apache/activemq/blob/trunk/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java

if (randomize) {
            // Randomly, reorder the list by random swapping
            for (int i = 0; i < l.size(); i++) {
                // 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);
            }
        }



On Mon, Jan 20, 2014 at 8:51 PM, Rodrigo Ramos <crackduoro@gmail.com> wrote:

> Hello
>
> I´m going to use randomize transport option, but, first I want to know how
> does it work, in others words, What algorithm is used for randomize?
>
>
> Regards
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message