camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/7] git commit: CAMEL-6485 performance improvement in DefaultCamelContext with thanks to Eric
Date Tue, 25 Jun 2013 09:08:56 GMT
CAMEL-6485 performance improvement in DefaultCamelContext with thanks to Eric


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5a7c7752
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5a7c7752
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5a7c7752

Branch: refs/heads/camel-2.11.x
Commit: 5a7c775209942aa8bd01cb87037a01932d9bef2f
Parents: ddeae97
Author: Willem Jiang <ningjiang@apache.org>
Authored: Tue Jun 25 09:40:02 2013 +0800
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jun 25 11:05:51 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/impl/DefaultCamelContext.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5a7c7752/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index b059e86..e386aff 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -2372,12 +2372,14 @@ public class DefaultCamelContext extends ServiceSupport implements
ModelCamelCon
     }
 
     public ManagementStrategy getManagementStrategy() {
-        synchronized (managementStrategyInitialized) {
-            if (managementStrategyInitialized.compareAndSet(false, true)) {
-                managementStrategy = createManagementStrategy();
+        if (!managementStrategyInitialized.get()) {
+            synchronized (managementStrategyInitialized) {
+                if (managementStrategyInitialized.compareAndSet(false, true)) {
+                    managementStrategy = createManagementStrategy();
+                }
             }
-            return managementStrategy;
         }
+        return managementStrategy;
     }
 
     public void setManagementStrategy(ManagementStrategy managementStrategy) {


Mime
View raw message