public enum JschSessionPool extends Enum<JschSessionPool>
| Enum Constant and Description |
|---|
INSTANCE
单例对象
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(String key)
关闭SSH连接会话
|
void |
closeAll()
关闭所有SSH连接会话
|
com.jcraft.jsch.Session |
get(String key)
获取Session,不存在返回null
|
com.jcraft.jsch.Session |
getSession(String sshHost,
int sshPort,
String sshUser,
byte[] prvkey,
byte[] passphrase)
获得一个SSH跳板机会话,重用已经使用的会话
|
com.jcraft.jsch.Session |
getSession(String sshHost,
int sshPort,
String sshUser,
String sshPass)
获得一个SSH跳板机会话,重用已经使用的会话
|
com.jcraft.jsch.Session |
getSession(String sshHost,
int sshPort,
String sshUser,
String prvkey,
byte[] passphrase)
获得一个SSH跳板机会话,重用已经使用的会话
|
void |
put(String key,
com.jcraft.jsch.Session session)
加入Session
|
void |
remove(com.jcraft.jsch.Session session)
移除指定Session
|
static JschSessionPool |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JschSessionPool[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JschSessionPool INSTANCE
public static JschSessionPool[] values()
for (JschSessionPool c : JschSessionPool.values()) System.out.println(c);
public static JschSessionPool valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic com.jcraft.jsch.Session get(String key)
key - 键public com.jcraft.jsch.Session getSession(String sshHost, int sshPort, String sshUser, String sshPass)
sshHost - 跳板机主机sshPort - 跳板机端口sshUser - 跳板机用户名sshPass - 跳板机密码public com.jcraft.jsch.Session getSession(String sshHost, int sshPort, String sshUser, String prvkey, byte[] passphrase)
sshHost - 跳板机主机sshPort - 跳板机端口sshUser - 跳板机用户名prvkey - 跳板机私钥路径passphrase - 跳板机私钥密码public com.jcraft.jsch.Session getSession(String sshHost, int sshPort, String sshUser, byte[] prvkey, byte[] passphrase)
sshHost - 跳板机主机sshPort - 跳板机端口sshUser - 跳板机用户名prvkey - 跳板机私钥内容passphrase - 跳板机私钥密码public void put(String key, com.jcraft.jsch.Session session)
key - 键session - Sessionpublic void close(String key)
key - 主机,格式为user@host:portpublic void remove(com.jcraft.jsch.Session session)
session - Session会话public void closeAll()
Copyright © 2025. All rights reserved.