public GlobalRequestResult testNodesAvailability(URI requestUri, RealmModel realm, ApplicationModel application) {
List<String> mgmtUrls = getAllManagementUrls(requestUri, application);
if (mgmtUrls.isEmpty()) {
logger.debug("No management URL or no registered cluster nodes for the application " + application.getName());
return new GlobalRequestResult();
}
ApacheHttpClient4Executor executor = createExecutor();
try {
if (logger.isDebugEnabled()) logger.debug("Sending test nodes availability: " + mgmtUrls);
// Propagate this to all hosts
GlobalRequestResult result = new GlobalRequestResult();
for (String mgmtUrl : mgmtUrls) {
if (sendTestNodeAvailabilityRequest(realm, application, executor, mgmtUrl)) {
result.addSuccessRequest(mgmtUrl);
} else {
result.addFailedRequest(mgmtUrl);
}
}
return result;
} finally {
executor.getHttpClient().getConnectionManager().shutdown();