[ 
https://issues.apache.org/jira/browse/CAMEL-15245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17147118#comment-17147118
 ] 

Jh. To. commented on CAMEL-15245:
---------------------------------

I'm not shutting down the entire Camel context. For a given routeId my code is 
doing something like the following (pseudo-code follows):

{code:java}
// Get all routes
List<RouteStartupOrder> routes = 
camelContext.adapt(ExtendedCamelContext.class).getRouteStartupOrder();

// Filter routes by the provided routeId
List<RouteStartupOrder> filteredRoutes = ...

// Shut down only the routes with routeId
camelContext.getShutdownStrategy().shutdown(camelContext, filteredRoutes)
{code}

After the shutdown strategy timeout is exceeded a forceful shutdown of the 
routes with routeId is done by Camel. 

Then after the routes with routeId are started again, forceShutdown flag in the 
CamelContext is still set to true, and the routes with routeId cannot process 
any messages due the exception

{code:bash}
Caused by: java.util.concurrent.RejectedExecutionException: Run not allowed as 
ShutdownStrategy is forcing shutting down, will reject executing exchange: 
Exchange[]
{code}


> On route shutdown timeout DefaultShutdownStrategy.forceShutdown remains set 
> to true
> -----------------------------------------------------------------------------------
>
>                 Key: CAMEL-15245
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15245
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>         Environment: Linux Ubuntu 5.7.4-050704-generic #202006181331 SMP Thu 
> Jun 18 13:33:57 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Jh. To.
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.5.0
>
>
> I see the following behavior with the default shutdown strategy: when the 
> graceful shutdown of a route times-out, a forced shutdow is executed by 
> Camel. The following is logged in this case:
> {code:bash}
> 2020-06-25 14:59:57,640 INFO  http-nio-127.0.0.1-9080-exec-10 [] [] 
> org.apache.camel.impl.engine.DefaultShutdownStrategy - Starting to graceful 
> shutdown 1 routes (timeout 10 seconds)
> 2020-06-25 15:00:07,647 WARN  http-nio-127.0.0.1-9080-exec-10 [] [] 
> org.apache.camel.impl.engine.DefaultShutdownStrategy - Timeout occurred 
> during graceful shutdown. Forcing the routes to be shutdown now. Notice: some 
> resources may still be running as graceful shutdown did not complete 
> successfully.
> {code}
> After the forced shutdown succeeds the following is logged
> {code:bash}
> 2020-06-25 15:00:08,711 INFO  http-nio-127.0.0.1-9080-exec-10 [] [] 
> org.apache.camel.impl.engine.DefaultShutdownStrategy - Graceful shutdown of 1 
> routes completed in 11 seconds
> {code}
> After the starting the route however the default shutdown strategy from the 
> camel context has the forceShutdown flag set to true, causing the execution 
> of the route to fail as follows:
> {code:bash}
> Caused by: java.util.concurrent.RejectedExecutionException: Run not allowed 
> as ShutdownStrategy is forcing shutting down, will reject executing exchange: 
> Exchange[]
>       at 
> org.apache.camel.processor.SharedCamelInternalProcessor.continueProcessing(SharedCamelInternalProcessor.java:310)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:145)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.processor.SharedCamelInternalProcessor$1.process(SharedCamelInternalProcessor.java:110)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:107)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultProducerCache.send(DefaultProducerCache.java:185)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:176)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:172)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:153)
>  ~[camel-base-3.4.0.jar:3.4.0]
>       at 
> org.apache.camel.impl.engine.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:295)
>  ~[camel-base-3.4.0.jar:3.4.0]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to