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 2015/04/17 16:34:39 UTC
[1/2] camel git commit: CAMEL-8660: camel-ftp - Disconnect when no
messages dont call disconnect
Repository: camel
Updated Branches:
refs/heads/camel-2.15.x fc5833ca7 -> 8bb7466c9
refs/heads/master 2207ae39e -> 96cfe14c9
CAMEL-8660: camel-ftp - Disconnect when no messages dont call disconnect
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96cfe14c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96cfe14c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96cfe14c
Branch: refs/heads/master
Commit: 96cfe14c96c3b946142eb2a7691d73adcc5a037c
Parents: 2207ae3
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 17 16:37:20 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 17 16:37:20 2015 +0200
----------------------------------------------------------------------
.../apache/camel/component/file/GenericFileConsumer.java | 6 ++++--
.../apache/camel/component/file/NewFileConsumerTest.java | 2 +-
.../camel/component/file/remote/RemoteFileConsumer.java | 11 ++++++++++-
3 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/96cfe14c/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
index a0907ac..00afddc 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
@@ -174,7 +174,7 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
int polledMessages = processBatch(CastUtils.cast(q));
- postPollCheck();
+ postPollCheck(polledMessages);
return polledMessages;
}
@@ -284,8 +284,10 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
/**
* Override if required. Perform some checks (and perhaps actions) after we have polled.
+ *
+ * @param polledMessages number of polled messages
*/
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
// noop
}
http://git-wip-us.apache.org/repos/asf/camel/blob/96cfe14c/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java b/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
index ce9fa9e..9cb1332 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
@@ -70,7 +70,7 @@ public class NewFileConsumerTest extends ContextTestSupport {
protected FileConsumer newFileConsumer(Processor processor, GenericFileOperations<File> operations) {
return new FileConsumer(this, processor, operations) {
@Override
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
post = true;
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/96cfe14c/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index 2286cce..1bf501d 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -85,10 +85,19 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
}
@Override
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
if (log.isTraceEnabled()) {
log.trace("postPollCheck on " + getEndpoint().getConfiguration().remoteServerInformation());
}
+
+ // if we did not poll any messages, but are configured to disconnect then we need to do this now
+ // as there is no exchanges to be routed that otherwise will disconnect from the last UoW
+ if (polledMessages == 0) {
+ if (getEndpoint().isDisconnect()) {
+ log.trace("postPollCheck disconnect from: {}", getEndpoint());
+ disconnect();
+ }
+ }
}
@Override
[2/2] camel git commit: CAMEL-8660: camel-ftp - Disconnect when no
messages dont call disconnect
Posted by da...@apache.org.
CAMEL-8660: camel-ftp - Disconnect when no messages dont call disconnect
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8bb7466c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8bb7466c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8bb7466c
Branch: refs/heads/camel-2.15.x
Commit: 8bb7466c90305acbf5becb7fc0d32c4218caf74d
Parents: fc5833c
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 17 16:37:20 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 17 16:37:42 2015 +0200
----------------------------------------------------------------------
.../apache/camel/component/file/GenericFileConsumer.java | 6 ++++--
.../apache/camel/component/file/NewFileConsumerTest.java | 2 +-
.../camel/component/file/remote/RemoteFileConsumer.java | 11 ++++++++++-
3 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8bb7466c/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
index a0907ac..00afddc 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
@@ -174,7 +174,7 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
int polledMessages = processBatch(CastUtils.cast(q));
- postPollCheck();
+ postPollCheck(polledMessages);
return polledMessages;
}
@@ -284,8 +284,10 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
/**
* Override if required. Perform some checks (and perhaps actions) after we have polled.
+ *
+ * @param polledMessages number of polled messages
*/
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
// noop
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8bb7466c/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java b/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
index ce9fa9e..9cb1332 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/NewFileConsumerTest.java
@@ -70,7 +70,7 @@ public class NewFileConsumerTest extends ContextTestSupport {
protected FileConsumer newFileConsumer(Processor processor, GenericFileOperations<File> operations) {
return new FileConsumer(this, processor, operations) {
@Override
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
post = true;
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/8bb7466c/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index 2286cce..1bf501d 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -85,10 +85,19 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
}
@Override
- protected void postPollCheck() {
+ protected void postPollCheck(int polledMessages) {
if (log.isTraceEnabled()) {
log.trace("postPollCheck on " + getEndpoint().getConfiguration().remoteServerInformation());
}
+
+ // if we did not poll any messages, but are configured to disconnect then we need to do this now
+ // as there is no exchanges to be routed that otherwise will disconnect from the last UoW
+ if (polledMessages == 0) {
+ if (getEndpoint().isDisconnect()) {
+ log.trace("postPollCheck disconnect from: {}", getEndpoint());
+ disconnect();
+ }
+ }
}
@Override