本文整理了Java中com.jcraft.jsch.Session.getPortForwardingL()
方法的一些代码示例,展示了Session.getPortForwardingL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.getPortForwardingL()
方法的具体详情如下:
包路径:com.jcraft.jsch.Session
类名称: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());
}
}
内容来源于网络,如有侵权,请联系作者删除!