This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch 17031-fix
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 76b36c456e3c6ecff0d41277c78438821e958c01
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Fri Oct 1 13:05:06 2021 +0200

    CAMEL-17031 - Performances/Profiling: Avoid boolean allocation in 
EventHelper
---
 .../src/main/java/org/apache/camel/support/EventHelper.java           | 4 ++--
 1 file changed, 2 insertions(+), 2 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 fbc26ce..f144ac9 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
@@ -44,6 +44,7 @@ public final class EventHelper {
     // be left as-is.
 
     private static final Logger LOG = 
LoggerFactory.getLogger(EventHelper.class);
+    private static volatile boolean started;
 
     private EventHelper() {
     }
@@ -1300,8 +1301,7 @@ 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) {
+        if (!started && notifier instanceof StatefulService) {
             started = ((StatefulService) notifier).isStarted();
         }
         if (!started) {

Reply via email to