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 2016/05/07 08:45:38 UTC

camel git commit: CAMEL-9953: Camel-ssh: Review logic in doStart and doStop in the SshConsumer and SshProducer

Repository: camel
Updated Branches:
  refs/heads/master 850fc3d2d -> e512dd002


CAMEL-9953: Camel-ssh: Review logic in doStart and doStop in the SshConsumer and SshProducer


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e512dd00
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e512dd00
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e512dd00

Branch: refs/heads/master
Commit: e512dd0020e5de640d285b0cbb5edfadc06f1f37
Parents: 850fc3d
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sat May 7 10:40:20 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat May 7 10:40:20 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/ssh/SshConsumer.java     | 12 ++++++++----
 .../org/apache/camel/component/ssh/SshProducer.java     |  8 ++++----
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e512dd00/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
index 682268a..da12bd2 100644
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
+++ b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
@@ -33,24 +33,28 @@ public class SshConsumer extends ScheduledPollConsumer {
     
     @Override
     protected void doStart() throws Exception {
-        super.doStart();
-
         client = SshClient.setUpDefaultClient();
         client.start();
+        
+        super.doStart();
     }
 
     @Override
     protected void doStop() throws Exception {
+        super.doStop();
+        
         if (client != null) {
             client.stop();
             client = null;
         }
-
-        super.doStop();
     }
 
     @Override
     protected int poll() throws Exception {
+        if (!isRunAllowed()) {
+            return 0;
+        }
+        
         String command = endpoint.getPollCommand();
         SshResult result = SshHelper.sendExecCommand(command, endpoint, client);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e512dd00/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
index a2867cb..7c4b663 100644
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
+++ b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
@@ -34,20 +34,20 @@ public class SshProducer extends DefaultProducer {
     
     @Override
     protected void doStart() throws Exception {
-        super.doStart();
-
         client = SshClient.setUpDefaultClient();
         client.start();
+        
+        super.doStart();
     }
 
     @Override
     protected void doStop() throws Exception {
+        super.doStop();
+        
         if (client != null) {
             client.stop();
             client = null;
         }
-
-        super.doStop();
     }
 
     @Override