This commit is contained in:
Looly
2022-06-10 09:00:30 +08:00
parent ea7716a517
commit 16dfcf3154
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ public enum JschSessionPool {
*/
public Session getSession(String sshHost, int sshPort, String sshUser, String sshPass) {
final String key = StrUtil.format("{}@{}:{}", sshUser, sshHost, sshPort);
return this.cache.get(key, (conn)->null != conn && conn.isConnected(), ()-> JschUtil.openSession(sshHost, sshPort, sshUser, sshPass));
return this.cache.get(key, Session::isConnected, ()-> JschUtil.openSession(sshHost, sshPort, sshUser, sshPass));
}
/**
@@ -57,7 +57,7 @@ public enum JschSessionPool {
*/
public Session getSession(String sshHost, int sshPort, String sshUser, String prvkey, byte[] passphrase) {
final String key = StrUtil.format("{}@{}:{}", sshUser, sshHost, sshPort);
return this.cache.get(key, (conn)->null != conn && conn.isConnected(), ()->JschUtil.openSession(sshHost, sshPort, sshUser, prvkey, passphrase));
return this.cache.get(key, Session::isConnected, ()->JschUtil.openSession(sshHost, sshPort, sshUser, prvkey, passphrase));
}
/**