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;
}
}
Aggregations