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:51:41 UTC

svn commit: r1419252 - in /camel/branches/camel-2.9.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:51:40 2012
New Revision: 1419252

URL: http://svn.apache.org/viewvc?rev=1419252&view=rev
Log:
CAMEL-5854 adviceWith() just needs to start the route when the camel context is started
Merged revisions 1419248 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x

................
  r1419248 | ningjiang | 2012-12-10 15:40:29 +0800 (Mon, 10 Dec 2012) | 11 lines
  
  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.9.x/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/IsUseAdviceWithJUnit4Test.java
      - copied unchanged from r1419248, camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/IsUseAdviceWithJUnit4Test.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java

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

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

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java?rev=1419252&r1=1419251&r2=1419252&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java Mon Dec 10 07:51:40 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;
@@ -263,8 +264,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;
     }