Search in sources :

Example 16 with ClusterConnection

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);
}
Also used : ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) Topology(org.apache.activemq.artemis.core.client.impl.Topology) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) XAException(javax.transaction.xa.XAException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Aggregations

ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)16 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)7 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)6 TopologyMemberImpl (org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl)6 Topology (org.apache.activemq.artemis.core.client.impl.Topology)5 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)5 ClusterManager (org.apache.activemq.artemis.core.server.cluster.ClusterManager)5 ClusterConnectionImpl (org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl)4 IOException (java.io.IOException)3 SQLException (java.sql.SQLException)3 XAException (javax.transaction.xa.XAException)3 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)3 MessageFlowRecord (org.apache.activemq.artemis.core.server.cluster.MessageFlowRecord)2 Test (org.junit.Test)2 URISyntaxException (java.net.URISyntaxException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ExecutorService (java.util.concurrent.ExecutorService)1 JMSException (javax.jms.JMSException)1