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 2020/11/03 05:41:17 UTC

[camel] branch master updated: Make double checked locking in factory getter methods of AbstractCamelContext thread-safe. (#4554)

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 75bf04b  Make double checked locking in factory getter methods of AbstractCamelContext thread-safe. (#4554)
75bf04b is described below

commit 75bf04b4af0d280a498ca597f44ee2aa09aa8b55
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Tue Nov 3 06:40:47 2020 +0100

    Make double checked locking in factory getter methods of AbstractCamelContext thread-safe. (#4554)
---
 .../java/org/apache/camel/impl/engine/AbstractCamelContext.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index cf50377..60499e6 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -199,15 +199,15 @@ public abstract class AbstractCamelContext extends BaseService
     private final ThreadLocal<Boolean> isStartingRoutes = new ThreadLocal<>();
     private final ThreadLocal<Boolean> isSetupRoutes = new ThreadLocal<>();
     private final Map<String, FactoryFinder> factories = new ConcurrentHashMap<>();
-    private FactoryFinder bootstrapFactoryFinder;
+    private volatile FactoryFinder bootstrapFactoryFinder;
     private ConfigurerResolver bootstrapConfigurerResolver;
     private final Map<String, RouteService> routeServices = new LinkedHashMap<>();
     private final Map<String, RouteService> suspendedRouteServices = new LinkedHashMap<>();
     private final Object lock = new Object();
     private final RouteController internalRouteController = new InternalRouteController(this);
     private final InternalRouteStartupManager internalRouteStartupManager = new InternalRouteStartupManager(this);
-    private DeferServiceFactory deferServiceFactory;
-    private AnnotationBasedProcessorFactory annotationBasedProcessorFactory;
+    private volatile DeferServiceFactory deferServiceFactory;
+    private volatile AnnotationBasedProcessorFactory annotationBasedProcessorFactory;
     private final List<RouteStartupOrder> routeStartupOrder = new ArrayList<>();
     private final StopWatch stopWatch = new StopWatch(false);
     private final Map<Class<?>, Object> extensions = new ConcurrentHashMap<>();