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 def04ab CAMEL-17031 - Performances/Profiling: Avoid boolean allocation in EventHelper (#6194) def04ab is described below commit def04abc3f28581fcddef071ce2acff2673a49a9 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Oct 1 16:51:24 2021 +0200 CAMEL-17031 - Performances/Profiling: Avoid boolean allocation in EventHelper (#6194) --- .../src/main/java/org/apache/camel/support/EventHelper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/camel-support/src/main/java/org/apache/camel/support/EventHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/EventHelper.java index 9dda3ae..cdb21bb 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/EventHelper.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/EventHelper.java @@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; public final class EventHelper { // This implementation has been optimized to be as fast and not create unnecessary objects or lambdas. - // So therefore there is some code that seems duplicated. But this code is used frequently during routing and should + // Therefore there is some code that seems duplicated. But this code is used frequently during routing and should // be left as-is. private static final Logger LOG = LoggerFactory.getLogger(EventHelper.class); @@ -1299,20 +1299,14 @@ public final class EventHelper { } private static boolean doNotifyEvent(EventNotifier notifier, CamelEvent event) { - // only notify if notifier is started - boolean started = true; if (notifier instanceof StatefulService) { // only notify if notifier is started (when stateful service) - started = ((StatefulService) notifier).isStarted(); + boolean started = ((StatefulService) notifier).isStarted(); if (!started) { LOG.debug("Ignoring notifying event {}. The EventNotifier has not been started yet: {}", event, notifier); return false; } } - if (!started) { - LOG.debug("Ignoring notifying event {}. The EventNotifier has not been started yet: {}", event, notifier); - return false; - } if (!notifier.isEnabled(event)) { LOG.trace("Notifier: {} is not enabled for the event: {}", notifier, event);