本文整理了Java中com.jcraft.jsch.Session.setServerAliveCountMax()
方法的一些代码示例,展示了Session.setServerAliveCountMax()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.setServerAliveCountMax()
方法的具体详情如下:
包路径:com.jcraft.jsch.Session
类名称:Session
方法名:setServerAliveCountMax
[英]Sets the number of keep-alive messages which may be sent without receiving any messages back from the server. If this threshold is reached while keep-alive messages are being sent, the connection will be disconnected. The default value is one.
[中]设置可在不接收服务器返回的任何消息的情况下发送的保持活动消息数。如果在发送保持活动状态消息时达到此阈值,则连接将断开。默认值为1。
代码示例来源:origin: apache/nifi
session.setTimeout(ctx.getProperty(FileTransfer.DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());
if (!ctx.getProperty(USE_KEEPALIVE_ON_TIMEOUT).asBoolean()) {
session.setServerAliveCountMax(0); // do not send keepalive message on SocketTimeoutException
代码示例来源:origin: spring-projects/spring-integration
jschSession.setServerAliveCountMax(this.serverAliveCountMax);
代码示例来源:origin: org.rundeck/rundeck-core
private static void configureSessionServerAliveCountMax(Map<String, String> config, Session session) {
String serverAliveCountMax = config.get(SSH_CONFIG_SERVER_ALIVE_COUNT_MAX);
if (serverAliveCountMax != null) {
try {
session.setServerAliveCountMax(Integer.parseInt(serverAliveCountMax));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: youngMen1/JAVA-
public SftpClient init() {
try {
Properties config = new Properties();
String host = PropertiesUtil.getString("sftp.host");
int port = PropertiesUtil.getInt("sftp.port");
String userName = PropertiesUtil.getString("sftp.user.name");
String password = PropertiesUtil.getString("sftp.user.password");
int timeout = PropertiesUtil.getInt("sftp.timeout");
int aliveMax = PropertiesUtil.getInt("sftp.aliveMax");
JSch jsch = new JSch(); // 创建JSch对象
session = jsch.getSession(userName, host, port); // 根据用户名,主机ip,端口获取一个Session对象
if (password != null) {
session.setPassword(password); // 设置密码
}
config.put("userauth.gssapi-with-mic", "no");
config.put("StrictHostKeyChecking", "no");
session.setConfig(config); // 为Session对象设置properties
session.setTimeout(timeout); // 设置timeout时间
session.setServerAliveCountMax(aliveMax);
session.connect(); // 通过Session建立链接
channel = (ChannelSftp)session.openChannel("sftp"); // 打开SFTP通道
channel.connect(); // 建立SFTP通道的连接
logger.info("SSH Channel connected.");
} catch (JSchException e) {
throw new FtpException("", e);
}
return this;
}
代码示例来源:origin: com.jcabi/jcabi-ssh
(int) TimeUnit.SECONDS.toMillis(Tv.TEN)
);
session.setServerAliveCountMax(Tv.MILLION);
session.connect();
return session;
代码示例来源:origin: org.springframework.integration/spring-integration-sftp
jschSession.setServerAliveCountMax(this.serverAliveCountMax);
代码示例来源:origin: jcabi/jcabi-ssh
(int) TimeUnit.SECONDS.toMillis(Tv.TEN)
);
session.setServerAliveCountMax(Tv.MILLION);
session.connect();
return session;
代码示例来源:origin: com.jcabi/jcabi-ssh
(int) TimeUnit.SECONDS.toMillis(Tv.TEN)
);
session.setServerAliveCountMax(Tv.MILLION);
session.connect();
return session;
代码示例来源:origin: jcabi/jcabi-ssh
(int) TimeUnit.SECONDS.toMillis(Tv.TEN)
);
session.setServerAliveCountMax(Tv.MILLION);
session.connect();
return session;
代码示例来源:origin: org.apache.ant/ant-jsch
session.setServerAliveCountMax(getServerAliveCountMax());
session.setServerAliveInterval(getServerAliveIntervalSeconds() * 1000);
代码示例来源:origin: org.apache.camel/camel-ftp
session.setServerAliveCountMax(sftpConfig.getServerAliveCountMax());
代码示例来源:origin: org.jetbrains.intellij.deps/commons-vfs2
session.setServerAliveCountMax(keepAliveCountMax);
代码示例来源:origin: org.apache.nifi/nifi-standard-processors
session.setTimeout(ctx.getProperty(FileTransfer.DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());
if (!ctx.getProperty(USE_KEEPALIVE_ON_TIMEOUT).asBoolean()) {
session.setServerAliveCountMax(0); // do not send keepalive message on SocketTimeoutException
代码示例来源:origin: com.github.robtimus/sftp-fs
session.setServerAliveCountMax(count);
内容来源于网络,如有侵权,请联系作者删除!