org.apache.activemq.artemis.core.cluster.DiscoveryEntry

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

1. DiscoveryBaseTest#dump()

View license
protected static void dump(List<TransportConfiguration> sortedExpected, List<DiscoveryEntry> sortedActual) {
    System.out.println("wrong broadcasts received");
    System.out.println("expected");
    System.out.println("----------------------------");
    for (TransportConfiguration transportConfiguration : sortedExpected) {
        System.out.println("transportConfiguration = " + transportConfiguration);
    }
    System.out.println("----------------------------");
    System.out.println("actual");
    System.out.println("----------------------------");
    for (DiscoveryEntry discoveryEntry : sortedActual) {
        System.out.println("transportConfiguration = " + discoveryEntry.getConnector());
    }
    System.out.println("----------------------------");
}

2. ServerLocatorImpl#connectorsChanged()

View license
@Override
public synchronized void connectorsChanged(List<DiscoveryEntry> newConnectors) {
    if (receivedTopology) {
        return;
    }
    TransportConfiguration[] newInitialconnectors = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, newConnectors.size());
    int count = 0;
    for (DiscoveryEntry entry : newConnectors) {
        newInitialconnectors[count++] = entry.getConnector();
        if (ha && topology.getMember(entry.getNodeID()) == null) {
            TopologyMemberImpl member = new TopologyMemberImpl(entry.getNodeID(), null, null, entry.getConnector(), null);
            // on this case we set it as zero as any update coming from server should be accepted
            topology.updateMember(0, entry.getNodeID(), member);
        }
    }
    this.initialConnectors = newInitialconnectors.length == 0 ? null : newInitialconnectors;
    if (clusterConnection && !receivedTopology && this.getNumInitialConnectors() > 0) {
        // The node is alone in the cluster. We create a connection to the new node
        // to trigger the node notification to form the cluster.
        Runnable connectRunnable = new Runnable() {

            @Override
            public void run() {
                try {
                    connect();
                } catch (ActiveMQException e) {
                    ActiveMQClientLogger.LOGGER.errorConnectingToNodes(e);
                }
            }
        };
        if (startExecutor != null) {
            startExecutor.execute(connectRunnable);
        } else {
            connectRunnable.run();
        }
    }
}