Search in sources :

Example 1 with ShutdownRunningTask

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);
        }
    }
}
Also used : ShutdownRunningTask(org.apache.camel.ShutdownRunningTask) Consumer(org.apache.camel.Consumer) RouteStartupOrder(org.apache.camel.spi.RouteStartupOrder)

Aggregations

Consumer (org.apache.camel.Consumer)1 ShutdownRunningTask (org.apache.camel.ShutdownRunningTask)1 RouteStartupOrder (org.apache.camel.spi.RouteStartupOrder)1