use of org.apache.activemq.artemis.core.server.cluster.ClusterConnection in project activemq-artemis by apache.
the class ActiveMQTestBase method waitForTopology.
protected void waitForTopology(final ActiveMQServer server, String clusterConnectionName, final int nodes, final long timeout) throws Exception {
logger.debug("waiting for " + nodes + " on the topology for server = " + server);
long start = System.currentTimeMillis();
ClusterConnection clusterConnection = server.getClusterManager().getClusterConnection(clusterConnectionName);
Topology topology = clusterConnection.getTopology();
do {
if (nodes == topology.getMembers().size()) {
return;
}
Thread.sleep(10);
} while (System.currentTimeMillis() - start < timeout);
String msg = "Timed out waiting for cluster topology of " + nodes + " (received " + topology.getMembers().size() + ") topology = " + topology + ")";
ActiveMQServerLogger.LOGGER.error(msg);
throw new Exception(msg);
}
Aggregations