diff options
-rw-r--r-- | modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java index 651f9125..d11bc5c8 100644 --- a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java +++ b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java @@ -22,30 +22,39 @@ public class IgniteClusterHealthIndicator implements HealthIndicator { @Override public Health health() { - final Ignite instance = igniteInstanceInitializerSpecificCommunication.getInstance(); + try { + final Ignite instance = igniteInstanceInitializerSpecificCommunication.getInstance(); - // check if Apache Ignite cluster is active - if (!instance.cluster().active()) { - return Health.outOfService().build(); + // check if Apache Ignite cluster is active + if (!instance.cluster().active()) { + return Health.outOfService().build(); - } + } - final Health.Builder healthBuilder; - // Status UP requires more than 1 node because MS-Connector and eIDAS-Node operations as - // micro-services - if (instance.cluster().nodes().size() > 1) { - healthBuilder = Health.up(); + final Health.Builder healthBuilder; + // Status UP requires more than 1 node because MS-Connector and eIDAS-Node + // operations as + // micro-services + if (instance.cluster().nodes().size() > 1) { + healthBuilder = Health.up(); - } else { - // Something looks wrong if only a single node was found because MS-Connector and eIDAS-Node - // operations as micro-services - healthBuilder = Health.outOfService(); + } else { + // Something looks wrong if only a single node was found because MS-Connector + // and eIDAS-Node + // operations as micro-services + healthBuilder = Health.outOfService(); - } + } + + healthBuilder.withDetail("#Nodes", instance.cluster().nodes().size()); + log.trace("Ignite state. #Nodes: {}", instance.cluster().nodes().size()); + return healthBuilder.build(); - healthBuilder.withDetail("#Nodes", instance.cluster().nodes().size()); - log.trace("Ignite state. #Nodes: {}", instance.cluster().nodes().size()); - return healthBuilder.build(); + } catch (Exception e) { + log.warn("Apache Ignite Health-Check has an error", e); + return Health.outOfService().build(); + + } } |