camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-9953: Camel-ssh: Review logic in doStart and doStop in the SshConsumer and SshProducer
Date Sat, 07 May 2016 09:08:45 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 5475d83f5 -> 0db67e2f9


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/0db67e2f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0db67e2f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0db67e2f

Branch: refs/heads/camel-2.16.x
Commit: 0db67e2f9b809983031ac037b4bcda5ff04f537a
Parents: 5475d83
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Sat May 7 10:40:20 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Sat May 7 11:07:57 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/0db67e2f/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/0db67e2f/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


Mime
View raw message