I found this when I was debugging through the connection creation code. I have a cluster of 3 HornetQ servers. But the cluster is set up by explicitly specifying the individual connectors.
I am testing against trunk because this JIRA issue (https://jira.jboss.org/jira/browse/HORNETQ-222) was addressed in the Trunk.
In the HornetQConnectionFactor.java (line #567) we have:
// Note that each JMS connection gets it's own copy of the connection factory // This means there is one underlying remoting connection per jms connection (if not load balanced) ClientSessionFactory factory = sessionFactory.copy();
public int select(final int max)
{
if (first)
{
//We start on a random one
pos = random.getRandom().nextInt(max);
first = false;
}
else
{
pos++;
if (pos >= max)
{
pos = 0;
}
}
return pos;
}