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/11/28 15:57:54 UTC
svn commit: r1414740 -
/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Author: ningjiang
Date: Wed Nov 28 14:57:53 2012
New Revision: 1414740
URL: http://svn.apache.org/viewvc?rev=1414740&view=rev
Log:
CAMEL-5830 fix the NPE when the shutdown the route which is not started rightly.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1414740&r1=1414739&r2=1414740&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Wed Nov 28 14:57:53 2012
@@ -1874,21 +1874,28 @@ public class DefaultCamelContext extends
routeService.setRemovingRoutes(removingRoutes);
stopRouteService(routeService);
}
+
+ protected void logRouteState(Route route, String state) {
+ if (log.isInfoEnabled()) {
+ if (route.getConsumer() != null) {
+ log.info("Route: {} {}, was consuming from: {}", route.getId(), state, route.getConsumer().getEndpoint());
+ } else {
+ log.info("Route: {} {}.", route.getId(), state);
+ }
+ }
+ }
+
protected synchronized void stopRouteService(RouteService routeService) throws Exception {
routeService.stop();
for (Route route : routeService.getRoutes()) {
- if (log.isInfoEnabled()) {
- log.info("Route: " + route.getId() + " stopped, was consuming from: " + route.getConsumer().getEndpoint());
- }
+ logRouteState(route, "stoped");
}
}
protected synchronized void shutdownRouteService(RouteService routeService) throws Exception {
routeService.shutdown();
for (Route route : routeService.getRoutes()) {
- if (log.isInfoEnabled()) {
- log.info("Route: " + route.getId() + " shutdown and removed, was consuming from: " + route.getConsumer().getEndpoint());
- }
+ logRouteState(route, "shutdown and removed");
}
}
@@ -1896,9 +1903,7 @@ public class DefaultCamelContext extends
routeService.setRemovingRoutes(false);
routeService.suspend();
for (Route route : routeService.getRoutes()) {
- if (log.isInfoEnabled()) {
- log.info("Route: " + route.getId() + " suspended, was consuming from: " + route.getConsumer().getEndpoint());
- }
+ logRouteState(route, "suspended");
}
}