You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/02/01 11:16:19 UTC
[camel-kamelets-examples] branch main updated: Update example to use java imports
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-kamelets-examples.git
The following commit(s) were added to refs/heads/main by this push:
new a979405 Update example to use java imports
a979405 is described below
commit a979405a3f764c9bd94c4edb432598aa1980f19f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 1 12:16:08 2023 +0100
Update example to use java imports
---
jbang/chaos-monkey/ChaosMonkey.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/jbang/chaos-monkey/ChaosMonkey.java b/jbang/chaos-monkey/ChaosMonkey.java
index d99cec6..3ca94fa 100644
--- a/jbang/chaos-monkey/ChaosMonkey.java
+++ b/jbang/chaos-monkey/ChaosMonkey.java
@@ -1,5 +1,13 @@
-@org.apache.camel.BindToRegistry("chaosMonkeyCheck")
-public class ChaosMonkey extends org.apache.camel.impl.health.AbstractHealthCheck {
+package chaos;
+
+import java.util.Map;
+import java.util.Random;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.impl.health.AbstractHealthCheck;
+import org.apache.camel.health.HealthCheckResultBuilder;
+
+@BindToRegistry("chaosMonkeyCheck")
+public class ChaosMonkey extends AbstractHealthCheck {
private int num;
@@ -9,7 +17,7 @@ public class ChaosMonkey extends org.apache.camel.impl.health.AbstractHealthChec
}
public String status(String body) {
- num = new java.util.Random().nextInt(10);
+ num = new Random().nextInt(10);
if (num < 4) {
return "Chaos Moneky is here";
} else {
@@ -18,7 +26,7 @@ public class ChaosMonkey extends org.apache.camel.impl.health.AbstractHealthChec
}
@Override
- public void doCall(org.apache.camel.health.HealthCheckResultBuilder builder, java.util.Map<String, Object> options) {
+ public void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) {
if (num < 4) {
builder.detail("chaos-number", num).message("Chaos is here!!!").down();
} else {