You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/05/30 06:35:49 UTC

[camel] branch master updated: Fix mongodb tests

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 124bd58  Fix mongodb tests
     new 9a94926  Merge pull request #2951 from DenisIstomin/fix-mongodb-tests
124bd58 is described below

commit 124bd58b55dbe881662a5c3bba46fe75a2b8f520
Author: Denis Istomin <is...@gmail.com>
AuthorDate: Wed May 29 21:36:06 2019 +0500

    Fix mongodb tests
---
 .../apache/camel/component/mongodb3/MongoDbTailingProcess.java   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbTailingProcess.java b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbTailingProcess.java
index 813ee7c7..3e67dc1 100644
--- a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbTailingProcess.java
+++ b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbTailingProcess.java
@@ -178,6 +178,15 @@ public class MongoDbTailingProcess implements Runnable {
             if (keepRunning) {
                 LOG.debug("Cursor not found exception from MongoDB, will regenerate cursor. This is normal behaviour with tailable cursors.", e);
             }
+        } catch (IllegalStateException e) {
+            // cursor.hasNext() opens socket and waiting for data
+            // it throws exception when cursor is closed in another thread
+            // there is no way to stop hasNext() before closing cursor
+            if (keepRunning) {
+                throw e;
+            } else {
+                LOG.debug("Cursor closed exception from MongoDB, will regenerate cursor. This is normal behaviour with tailable cursors.", e);
+            }
         }
 
         // the loop finished, persist the lastValue just in case we are shutting