camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r558775 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
Date Mon, 23 Jul 2007 15:29:23 GMT
Author: jstrachan
Date: Mon Jul 23 08:29:22 2007
New Revision: 558775

URL: http://svn.apache.org/viewvc?view=rev&rev=558775
Log:
added explicit initialization of the lazy-initialised properties on the CamelContext in the
start() method (doStart() to be precise)

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?view=diff&rev=558775&r1=558774&r2=558775
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Mon Jul 23 08:29:22 2007
@@ -31,8 +31,8 @@
 import org.apache.camel.spi.ComponentResolver;
 import org.apache.camel.spi.ExchangeConverter;
 import org.apache.camel.spi.Injector;
-import org.apache.camel.spi.LanguageResolver;
 import org.apache.camel.spi.Language;
+import org.apache.camel.spi.LanguageResolver;
 import org.apache.camel.util.FactoryFinder;
 import org.apache.camel.util.NoFactoryAvailableException;
 import org.apache.camel.util.ObjectHelper;
@@ -328,7 +328,6 @@
         this.languageResolver = languageResolver;
     }
 
-
     public boolean isAutoCreateComponents() {
         return autoCreateComponents;
     }
@@ -341,6 +340,7 @@
     //-----------------------------------------------------------------------
 
     protected void doStart() throws Exception {
+        forceLazyInitialization();
         if (components != null) {
             for (Component component : components.values()) {
                 startServices(component);
@@ -366,6 +366,17 @@
                 startServices(services);
             }
         }
+    }
+
+    /**
+     * Lets force some lazy initialization to occur upfront
+     * before we start any components and create routes
+     */
+    protected void forceLazyInitialization() {
+        getExchangeConverter();
+        getInjector();
+        getLanguageResolver();
+        getTypeConverter();
     }
 
     /**

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?view=diff&rev=558775&r1=558774&r2=558775
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
Mon Jul 23 08:29:22 2007
@@ -79,9 +79,6 @@
         if (eventEndpoint == null) {
             eventEndpoint = createEventEndpoint();
         }
-        // lets force lazy initialisation
-        getInjector();
-
         start();
     }
 



Mime
View raw message