com.jcraft.jsch.Session.getPortForwardingL()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.jcraft.jsch.Session.getPortForwardingL()方法的一些代码示例,展示了Session.getPortForwardingL()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.getPortForwardingL()方法的具体详情如下:
包路径:com.jcraft.jsch.Session
类名称:Session
方法名:getPortForwardingL

Session.getPortForwardingL介绍

[英]returns a snapshot of the current local port forwarding configurations. This is mainly useful for debug purposes.
[中]返回当前本地端口转发配置的快照。这主要用于调试目的。

代码示例

代码示例来源:origin: openshift/openshift-java-client

public boolean isStarted(final Session session) throws OpenShiftSSHOperationException {
  if (session == null || !session.isConnected()) {
    return false;
  }
  try {
    // returned format : localPort:remoteHost:remotePort
    final String[] portForwardingL = session.getPortForwardingL();
    final String key = this.localPort + ":" + this.remoteAddress + ":" + this.remotePort;
    Arrays.sort(portForwardingL);
    final int r = Arrays.binarySearch(portForwardingL, key);
    return r >= 0;
  } catch (JSchException e) {
    throw new OpenShiftSSHOperationException(e, "Failed to retrieve SSH ports forwarding");
  }
}

代码示例来源:origin: org.fusesource.fabric.openshift/openshift-java-client

public boolean isStarted(final Session session) throws OpenShiftSSHOperationException {
  if (session == null || !session.isConnected()) {
    return false;
  }
  try {
    // returned format : localPort:remoteHost:remotePort
    final String[] portForwardingL = session.getPortForwardingL();
    final String key = this.localPort + ":" + this.remoteAddress + ":" + this.remotePort;
    Arrays.sort(portForwardingL);
    final int r = Arrays.binarySearch(portForwardingL, key);
    return r >= 0;
  } catch (JSchException e) {
    throw new OpenShiftSSHOperationException(e, "Failed to retrieve SSH ports forwarding");
  }
}

代码示例来源:origin: org.fusesource.fabric.openshift/openshift-java-client

public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException {
  try {
    return this.session != null && this.session.isConnected() && this.session.getPortForwardingL().length > 0;
  } catch (JSchException e) {
    throw new OpenShiftSSHOperationException(e,
        "Unable to verify if port-forwarding has been started for application \"{0}\"", this.getName());
  }
}

代码示例来源:origin: openshift/openshift-java-client

public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException {
  try {
    return this.session != null && this.session.isConnected() && this.session.getPortForwardingL().length > 0;
  } catch (JSchException e) {
    throw new OpenShiftSSHOperationException(e,
        "Unable to verify if port-forwarding has been started for application \"{0}\"", this.getName());
  }
}

代码示例来源:origin: openshift/openshift-java-client

/**
 * Check if port forwarding has been started
 * 
 * @return true if port forwarding is started, false otherwise
 * @throws OpenShiftSSHOperationException
 */
public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException {
  try {
    return isConnected()
        && session.getPortForwardingL().length > 0;
  } catch (JSchException e) {
    throw new OpenShiftSSHOperationException(e,
        "Unable to verify if port-forwarding has been started for application \"{0}\"",
        application.getName());
  }
}

相关文章

微信公众号

最新文章

更多