You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/05/29 11:28:25 UTC
[1/2] camel git commit: CAMEL-9826: used CountDownLatch to wait for
stop
Repository: camel
Updated Branches:
refs/heads/master dd0ed95d5 -> 100ce2487
CAMEL-9826: used CountDownLatch to wait for stop
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1552d093
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1552d093
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1552d093
Branch: refs/heads/master
Commit: 1552d093786156ccb43eb488a120fb854021f986
Parents: dd0ed95
Author: Arno Noordover <an...@users.noreply.github.com>
Authored: Sun May 29 12:47:05 2016 +0200
Committer: Arno Noordover <an...@users.noreply.github.com>
Committed: Sun May 29 12:47:05 2016 +0200
----------------------------------------------------------------------
.../component/mongodb/MongoDbTailingProcess.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1552d093/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
index 2eaf6e1..ed11b6d 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
@@ -39,6 +39,7 @@ public class MongoDbTailingProcess implements Runnable {
public volatile boolean keepRunning = true;
public volatile boolean stopped; // = false
+ private volatile CountDownLatch stoppedLatch;
private final DBCollection dbCol;
private final MongoDbEndpoint endpoint;
@@ -98,6 +99,7 @@ public class MongoDbTailingProcess implements Runnable {
*/
@Override
public void run() {
+ stoppedLatch = new CountDownLatch(1);
while (keepRunning) {
doRun();
// if the previous call didn't return because we have stopped running, then regenerate the cursor
@@ -120,6 +122,7 @@ public class MongoDbTailingProcess implements Runnable {
}
stopped = true;
+ stoppedLatch.countDown();
}
protected void stop() throws Exception {
@@ -131,8 +134,7 @@ public class MongoDbTailingProcess implements Runnable {
if (cursor != null) {
cursor.close();
}
- // wait until the main loop acknowledges the stop
- while (!stopped) { }
+ awaitStopped();
if (LOG.isInfoEnabled()) {
LOG.info("Stopped MongoDB Tailable Cursor consumer, bound to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
}
@@ -183,4 +185,12 @@ public class MongoDbTailingProcess implements Runnable {
}
return answer;
}
+
+ private void awaitStopped() throws InterruptedException {
+ if (!stopped) {
+ LOG.info("Going to wait for stopping");
+ stoppedLatch.await();
+ }
+ }
+
}
[2/2] camel git commit: CAMEL-9826: Remove import
Posted by da...@apache.org.
CAMEL-9826: Remove import
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/100ce248
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/100ce248
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/100ce248
Branch: refs/heads/master
Commit: 100ce2487a0f627795055c3d4f73d4c1897d1ab2
Parents: 1552d09
Author: Arno Noordover <an...@users.noreply.github.com>
Authored: Sun May 29 13:13:32 2016 +0200
Committer: Arno Noordover <an...@users.noreply.github.com>
Committed: Sun May 29 13:13:32 2016 +0200
----------------------------------------------------------------------
.../org/apache/camel/component/mongodb/MongoDbTailingProcess.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/100ce248/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
index ed11b6d..40a4a66 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
@@ -18,7 +18,6 @@
package org.apache.camel.component.mongodb;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import com.mongodb.BasicDBObject;
import com.mongodb.Bytes;