aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <>2024-03-12 18:02:51 +0100
committerThomas <>2024-03-12 18:02:51 +0100
commitc4edfbf6a41984426c958aae39a762a36487c4cf (patch)
tree386079b68db3a2dbf27fbfbe549e5bbb11e8a6ab
parent2f89e46e31661a688b9372a7586f8d64afcf0df4 (diff)
downloadNational_eIDAS_Gateway-c4edfbf6a41984426c958aae39a762a36487c4cf.tar.gz
National_eIDAS_Gateway-c4edfbf6a41984426c958aae39a762a36487c4cf.tar.bz2
National_eIDAS_Gateway-c4edfbf6a41984426c958aae39a762a36487c4cf.zip
chore(core): catch exceptions in Apache Ignite health-check implementation
-rw-r--r--modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/health/IgniteClusterHealthIndicator.java45
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();
+
+ }
}