Search in sources :

Example 1 with HAManager

use of org.apache.activemq.artemis.core.server.cluster.ha.HAManager in project wildfly by wildfly.

the class HTTPUpgradeService method selectServer.

private static ActiveMQServer selectServer(HttpServerExchange exchange, ActiveMQServer rootServer) {
    String activemqServerName = exchange.getRequestHeaders().getFirst(TransportConstants.ACTIVEMQ_SERVER_NAME);
    if (activemqServerName == null) {
        return rootServer;
    }
    ClusterManager clusterManager = rootServer.getClusterManager();
    if (clusterManager != null) {
        HAManager haManager = clusterManager.getHAManager();
        if (haManager != null) {
            for (Map.Entry<String, ActiveMQServer> entry : haManager.getBackupServers().entrySet()) {
                if (entry.getKey().equals(activemqServerName)) {
                    return entry.getValue();
                }
            }
        }
    }
    if (activemqServerName.equals(rootServer.getConfiguration().getName())) {
        return rootServer;
    } else {
        return null;
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) HAManager(org.apache.activemq.artemis.core.server.cluster.ha.HAManager) ClusterManager(org.apache.activemq.artemis.core.server.cluster.ClusterManager) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)1 ClusterManager (org.apache.activemq.artemis.core.server.cluster.ClusterManager)1 HAManager (org.apache.activemq.artemis.core.server.cluster.ha.HAManager)1