gnodet-bot commented on code in PR #29387:
URL: https://github.com/apache/camel/pull/29387#discussion_r4503539714
##########
components/camel-chaos/src/main/java/org/apache/camel/component/chaos/ChaosTargets.java:
##########
@@ -89,6 +110,169 @@ private static String checkEndpoints(CamelContext
camelContext, ChaosRule rule)
return null;
}
+ /**
+ * The hooks of the rule that can fire in the context now, for the list
and the report: of the hooks of an
+ * {@code endpoint=} or {@code component=} rule, {@code poll} only when a
route that consumes a matching endpoint
+ * polls on a schedule ({@link ScheduledPollConsumer}), and {@code send}
(and {@code reply}, the reply of a send)
+ * only when something sends to a matching endpoint. A hook where the rule
fired already can fire, whatever the
+ * context has now. The other hooks, and the hooks of the other targets,
are those of the rule.
+ */
+ static Set<Hook> hooksThatCanFire(Reach reach, ChaosRule rule) {
+ if (rule.target != ChaosRule.Target.ENDPOINT && rule.target !=
ChaosRule.Target.COMPONENT
+ || rule.lifecycle != null || reach == null) {
Review Comment:
💡 **Nit:** `&&` binds tighter than `||` so the semantics are correct, but
adding explicit parentheses around the `&&` clause makes the precedence
immediately obvious to readers.
```suggestion
if ((rule.target != ChaosRule.Target.ENDPOINT && rule.target !=
ChaosRule.Target.COMPONENT)
|| rule.lifecycle != null || reach == null) {
```
##########
components/camel-chaos/src/main/java/org/apache/camel/component/chaos/ChaosTargets.java:
##########
@@ -89,6 +110,169 @@ private static String checkEndpoints(CamelContext
camelContext, ChaosRule rule)
return null;
}
+ /**
+ * The hooks of the rule that can fire in the context now, for the list
and the report: of the hooks of an
+ * {@code endpoint=} or {@code component=} rule, {@code poll} only when a
route that consumes a matching endpoint
+ * polls on a schedule ({@link ScheduledPollConsumer}), and {@code send}
(and {@code reply}, the reply of a send)
+ * only when something sends to a matching endpoint. A hook where the rule
fired already can fire, whatever the
+ * context has now. The other hooks, and the hooks of the other targets,
are those of the rule.
+ */
+ static Set<Hook> hooksThatCanFire(Reach reach, ChaosRule rule) {
+ if (rule.target != ChaosRule.Target.ENDPOINT && rule.target !=
ChaosRule.Target.COMPONENT
+ || rule.lifecycle != null || reach == null) {
Review Comment:
💡 **Nit:** `&&` binds tighter than `||` so the semantics are correct, but
adding explicit parentheses around the `&&` clause makes the precedence
immediately obvious to readers.
```suggestion
if ((rule.target != ChaosRule.Target.ENDPOINT && rule.target !=
ChaosRule.Target.COMPONENT)
|| rule.lifecycle != null || reach == null) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]