private void timeoutHandlingConnectionChecker(
final Checker checker,
final Integer timeout,
final Map<String, String> responses,
final Set<String> running) {
String res = null;
try {
if (timeout == null) {
LOG.debug("No timeouts for resource connection checking ... ");
res = SyncopeConsoleSession.get().execute(checker).get();
} else if (timeout > 0) {
LOG.debug("Timeouts provided for resource connection checking ... ");
res = SyncopeConsoleSession.get().execute(checker).get(timeout, TimeUnit.SECONDS);
}
} catch (InterruptedException | TimeoutException e) {
LOG.warn("Connection with {} timed out", checker.getKey());
res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
TopologyNode.Status.UNREACHABLE, checker.getKey());
} catch (Exception e) {
LOG.error("Unexpected exception conneting to {}", checker.getKey(), e);
res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
TopologyNode.Status.FAILURE, checker.getKey());
}
if (res != null) {
responses.put(checker.getKey(), res);
}
running.remove(checker.getKey());
}