org.apache.activemq.artemis.core.server.cluster.ClusterConnection

Here are the examples of the java api class org.apache.activemq.artemis.core.server.cluster.ClusterConnection taken from open source projects.

1. RemotingServiceImpl#lookupClusterConnection()

View license
private ClusterConnection lookupClusterConnection(TransportConfiguration acceptorConfig) {
    String clusterConnectionName = (String) acceptorConfig.getParams().get(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.CLUSTER_CONNECTION);
    ClusterConnection clusterConnection = null;
    if (clusterConnectionName != null) {
        clusterConnection = clusterManager.getClusterConnection(clusterConnectionName);
    }
    // if not found we will still use the default name, even if a name was provided
    if (clusterConnection == null) {
        clusterConnection = clusterManager.getDefaultConnection(acceptorConfig);
    }
    return clusterConnection;
}

2. ActiveMQTestBase#waitForTopology()

View license
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);
}