use of org.apache.camel.ShutdownRunningTask in project camel by apache.
the class DefaultShutdownStrategy method shutdownRoutesNow.
/**
* Shutdown all the consumers immediately.
*
* @param routes the routes to shutdown
*/
protected void shutdownRoutesNow(List<RouteStartupOrder> routes) {
for (RouteStartupOrder order : routes) {
// set the route to shutdown as fast as possible by stopping after
// it has completed its current task
ShutdownRunningTask current = order.getRoute().getRouteContext().getShutdownRunningTask();
if (current != ShutdownRunningTask.CompleteCurrentTaskOnly) {
LOG.debug("Changing shutdownRunningTask from {} to " + ShutdownRunningTask.CompleteCurrentTaskOnly + " on route {} to shutdown faster", current, order.getRoute().getId());
order.getRoute().getRouteContext().setShutdownRunningTask(ShutdownRunningTask.CompleteCurrentTaskOnly);
}
for (Consumer consumer : order.getInputs()) {
shutdownNow(consumer);
}
}
}
Aggregations