Package org.aoju.bus.extra.ssh
Enum Class JSchSessionPool
- All Implemented Interfaces:
Serializable,Comparable<JSchSessionPool>,Constable
Jsch会话池
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionvoid关闭SSH连接会话voidcloseAll()关闭所有SSH连接会话com.jcraft.jsch.Session获取Session,不存在返回nullcom.jcraft.jsch.SessiongetSession(String sshHost, int sshPort, String sshUser, String sshPass) 获得一个SSH跳板机会话,重用已经使用的会话com.jcraft.jsch.SessiongetSession(String sshHost, int sshPort, String sshUser, String prvkey, byte[] passphrase) 获得一个SSH跳板机会话,重用已经使用的会话void加入Sessionvoidremove(com.jcraft.jsch.Session session) 移除指定Sessionstatic JSchSessionPoolReturns the enum constant of this class with the specified name.static JSchSessionPool[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
get
获取Session,不存在返回null- Parameters:
key- 键- Returns:
- Session
-
getSession
public com.jcraft.jsch.Session getSession(String sshHost, int sshPort, String sshUser, String sshPass) 获得一个SSH跳板机会话,重用已经使用的会话- Parameters:
sshHost- 跳板机主机sshPort- 跳板机端口sshUser- 跳板机用户名sshPass- 跳板机密码- Returns:
- SSH会话
-
getSession
public com.jcraft.jsch.Session getSession(String sshHost, int sshPort, String sshUser, String prvkey, byte[] passphrase) 获得一个SSH跳板机会话,重用已经使用的会话- Parameters:
sshHost- 跳板机主机sshPort- 跳板机端口sshUser- 跳板机用户名prvkey- 跳板机私钥路径passphrase- 跳板机私钥密码- Returns:
- SSH会话
-
put
加入Session- Parameters:
key- 键session- Session
-
close
关闭SSH连接会话- Parameters:
key- 主机,格式为user@host:port
-
remove
public void remove(com.jcraft.jsch.Session session) 移除指定Session- Parameters:
session- Session会话
-
closeAll
public void closeAll()关闭所有SSH连接会话
-