You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2012/12/10 08:40:30 UTC

svn commit: r1419248 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java tests/camel-itest/src/test/java/org/apache/camel/itest/issues/IsUseAdviceWithJUnit4Test.java

Author: ningjiang
Date: Mon Dec 10 07:40:29 2012
New Revision: 1419248

URL: http://svn.apache.org/viewvc?rev=1419248&view=rev
Log:
CAMEL-5854 adviceWith() just needs to start the route when the camel context is started

Merged revisions 1418595 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1418595 | ningjiang | 2012-12-08 10:38:52 +0800 (Sat, 08 Dec 2012) | 1 line
  
  CAMEL-5854 adviceWith() just needs to start the route when the camel context is started
........

Added:
    camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/IsUseAdviceWithJUnit4Test.java
      - copied unchanged from r1418595, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/IsUseAdviceWithJUnit4Test.java
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1418595

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java?rev=1419248&r1=1419247&r2=1419248&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java Mon Dec 10 07:40:29 2012
@@ -38,6 +38,7 @@ import org.apache.camel.Route;
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.ShutdownRoute;
 import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.StatefulService;
 import org.apache.camel.builder.AdviceWithRouteBuilder;
 import org.apache.camel.builder.AdviceWithTask;
 import org.apache.camel.builder.ErrorHandlerBuilderRef;
@@ -266,8 +267,13 @@ public class RouteDefinition extends Pro
         // log the merged route at info level to make it easier to end users to spot any mistakes they may have made
         log.info("AdviceWith route after: " + merged);
 
-        // and start it
-        camelContext.startRoute(merged);
+        // If the camel context is started then we start the route
+        if (camelContext instanceof StatefulService) {
+            StatefulService service = (StatefulService) camelContext;
+            if (service.isStarted()) {
+                camelContext.startRoute(merged);
+            }
+        }
         return merged;
     }