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

Claus Ibsen commented on CAMEL-9826:
------------------------------------

You got a CPU that is spiking in the while loop keep running at that line 132
{code}
"main" #1 prio=5 os_prio=31 tid=0x00007fa3a2003000 nid=0x1703 runnable 
[0x0000700000218000]
   java.lang.Thread.State: RUNNABLE
        at 
org.apache.camel.component.mongodb.MongoDbTailingProcess.stop(MongoDbTailingProcess.java:132)
        at 
org.apache.camel.component.mongodb.MongoDbTailableCursorConsumer.doStop(MongoDbTailableCursorConsumer.java:41)
        at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:102)
        at 
org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:142)
        at 
org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:381)
        at 
org.apache.camel.impl.DefaultShutdownStrategy.shutdownRoutesNow(DefaultShutdownStrategy.java:355)
        at 
org.apache.camel.impl.DefaultShutdownStrategy.doShutdown(DefaultShutdownStrategy.java:238)
        at 
org.apache.camel.impl.DefaultShutdownStrategy.shutdownForced(DefaultShutdownStrategy.java:146)
        at 
org.apache.camel.impl.DefaultCamelContext.doStop(DefaultCamelContext.java:3066)
        - locked <0x0000000795e68a70> (a 
org.apache.camel.spring.SpringCamelContext)
{code}

Using the concurrent / thread apis with the latch and whatnot is a much better 
approach to signal between threads and safely wait.
No other of the Camel components uses a endless while loop in their code.

> MongoDB consumer could potentially block during shutdown
> --------------------------------------------------------
>
>                 Key: CAMEL-9826
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9826
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-mongodb
>            Reporter: Claus Ibsen
>             Fix For: 2.18.0
>
>
> There is this endless while loop
> https://github.com/apache/camel/blob/master/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java#L132
> This should be using a CountDownLatch to await for the stop to complete so 
> there is no endless while loop.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to