This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 577f33e CAMEL-17587: camel-health - Make Health Check API simpler
577f33e is described below
commit 577f33e1ab542b6681036c7e3518702cc218bfb5
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 9 11:50:38 2022 +0100
CAMEL-17587: camel-health - Make Health Check API simpler
---
.../camel/impl/health/DefaultHealthCheckRegistry.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git
a/core/camel-health/src/main/java/org/apache/camel/impl/health/DefaultHealthCheckRegistry.java
b/core/camel-health/src/main/java/org/apache/camel/impl/health/DefaultHealthCheckRegistry.java
index 59cb0f4..b489d98 100644
---
a/core/camel-health/src/main/java/org/apache/camel/impl/health/DefaultHealthCheckRegistry.java
+++
b/core/camel-health/src/main/java/org/apache/camel/impl/health/DefaultHealthCheckRegistry.java
@@ -280,16 +280,21 @@ public class DefaultHealthCheckRegistry extends
ServiceSupport implements Health
public boolean isExcluded(HealthCheck healthCheck) {
if (excludePattern != null) {
String[] s = excludePattern.split(",");
+
String id = healthCheck.getId();
- String id2 = null;
+ if (PatternHelper.matchPatterns(id, s)) {
+ return true;
+ }
// special for route and consumer health checks
if (id.startsWith("route:")) {
- id2 = id.substring(6);
+ id = id.substring(6);
+ return PatternHelper.matchPatterns(id, s);
} else if (id.startsWith("consumer:")) {
- id2 = id.substring(9);
+ id = id.substring(9);
+ return PatternHelper.matchPatterns(id, s);
}
- return PatternHelper.matchPatterns(id, s) || (id2 != null &&
PatternHelper.matchPatterns(id2, s));
}
+
return false;
}