Author: ningjiang Date: Wed Mar 23 09:40:57 2011 New Revision: 1084522 URL: http://svn.apache.org/viewvc?rev=1084522&view=rev Log: CAMEL-3798 Use keepalive config parameters on sftp component
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java?rev=1084522&r1=1084521&r2=1084522&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java Wed Mar 23 09:40:57 2011 @@ -28,6 +28,8 @@ public class SftpConfiguration extends R private String privateKeyFile; private String privateKeyFilePassphrase; private String strictHostKeyChecking = "no"; + private int serverAliveInterval = 0; + private int serverAliveCountMax = 1; public SftpConfiguration() { setProtocol("sftp"); @@ -73,4 +75,21 @@ public class SftpConfiguration extends R public void setStrictHostKeyChecking(String strictHostKeyChecking) { this.strictHostKeyChecking = strictHostKeyChecking; } + + public void setServerAliveInterval(int serverAliveInterval) { + this.serverAliveInterval = serverAliveInterval; + } + + public int getServerAliveInterval() { + return serverAliveInterval; + } + + public void setServerAliveCountMax(int serverAliveCountMax) { + this.serverAliveCountMax = serverAliveCountMax; + } + + public int getServerAliveCountMax() { + return serverAliveCountMax; + } + } Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1084522&r1=1084521&r2=1084522&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Wed Mar 23 09:40:57 2011 @@ -159,7 +159,10 @@ public class SftpOperations implements R LOG.debug("Using StrickHostKeyChecking: " + sftpConfig.getStrictHostKeyChecking()); session.setConfig("StrictHostKeyChecking", sftpConfig.getStrictHostKeyChecking()); } - + + session.setServerAliveInterval(sftpConfig.getServerAliveInterval()); + session.setServerAliveCountMax(sftpConfig.getServerAliveCountMax()); + // set user information session.setUserInfo(new UserInfo() { public String getPassphrase() {