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

ASF GitHub Bot commented on CAMEL-11977:
----------------------------------------

GitHub user igorko opened a pull request:

    https://github.com/apache/camel/pull/2075

    CAMEL-11977: MongoDB Tailable cursor consumer fails to stop on shutdown

    cursor.hasNaxt() locks thread and waits for new object. Camel mongodb 
component uses loop to get new cursor objects, so we can just try if next is 
present without waiting for new object. tryNext() is what we need in this casre.
    
    According to mongoBD documentation:
    [](http://api.mongodb.com/java/current/com/mongodb/client/MongoCursor.html)
    tryNext() A special next() case that returns the next element in the 
iteration if available or null.
    
    So after exit hook injection. when java will call 
MongoDbTailingProcess.stop(), there will be no lock at  
MongoDbTailingProcess.run(). so MongoDbTailingProcess instance will be stopped.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/igorko/camel master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/2075.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2075
    
----
commit ba667d7aece178bf9e0d1c0cd69b2d1afd96cecd
Author: Igor Paliychuk <[email protected]>
Date:   2017-11-02T16:16:39Z

    CAMEL-11977: MongoDB Tailable cursor consumer fails to stop on shutdown

----


> MongoDB Tailable cursor consumer fails to stop on shutdown
> ----------------------------------------------------------
>
>                 Key: CAMEL-11977
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11977
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mongodb
>    Affects Versions: 2.20.0
>         Environment: Windows 10, Java 1.8
>            Reporter: Ihor Paliichuk
>            Priority: Major
>             Fix For: 2.20.1
>
>
> MongoDB Tailable cursor consumer fails to stop on shutdown(when using Ctrl+C) 
> if collection is not empty. Routes are described in xml file.
> [Camel (...) thread #8 - ShutdownTask] INFO  o.a.c.c.m.MongoDbTailingProcess 
> - Stopping MongoDB Tailable Cursor consumer, bound to collection: db: ..., 
> col: ... 
> [Camel (...) thread #8 - ShutdownTask] INFO  o.a.c.c.m.MongoDbTailingProcess 
> - Going to wait for stopping
> When collection is empty, all is ok and I see next line
> [Camel (...) thread #8 - ShutdownTask] INFO  o.a.c.c.m.MongoDbTailingProcess 
> - Stopped MongoDB Tailable Cursor consumer, bound to collection: db: ..., 
> col: ...



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to