Skip to content

Commit 7c2face

Browse files
committed
refactor: Handle two exceptions explicitly
1 parent 7386af8 commit 7c2face

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/fi/hsl/common/health/HealthServer.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ public boolean checkHealth() {
109109
if (result == null || !result) {
110110
return false; // Return false immediately if any check fails
111111
}
112-
} catch (ExecutionException ignore) {}
112+
} catch (ExecutionException e) {
113+
log.error("A health check task execution failed. Marking unhealthy.", e.getCause() != null ? e.getCause() : e);
114+
return false;
115+
} catch (InterruptedException e) {
116+
log.error("Health check interrupted. Marking unhealthy.", e);
117+
Thread.currentThread().interrupt();
118+
return false;
119+
}
113120
}
114121
} finally {
115122
for (Future<Boolean> f : futures) {

0 commit comments

Comments
 (0)