Enum Class JSchSessionPool

java.lang.Object
java.lang.Enum<JSchSessionPool>
org.aoju.bus.extra.ssh.JSchSessionPool
All Implemented Interfaces:
Serializable, Comparable<JSchSessionPool>, Constable

public enum JSchSessionPool extends Enum<JSchSessionPool>
Jsch会话池
Since:
Java 17+
Author:
Kimi Liu
  • Enum Constant Details

  • Method Details

    • values

      public static JSchSessionPool[] 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

      public static JSchSessionPool valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • get

      public com.jcraft.jsch.Session get(String key)
      获取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

      public void put(String key, com.jcraft.jsch.Session session)
      加入Session
      Parameters:
      key - 键
      session - Session
    • close

      public void close(String key)
      关闭SSH连接会话
      Parameters:
      key - 主机,格式为user@host:port
    • remove

      public void remove(com.jcraft.jsch.Session session)
      移除指定Session
      Parameters:
      session - Session会话
    • closeAll

      public void closeAll()
      关闭所有SSH连接会话