/** * Null safe disconnect */ private static void safeDisconnect(Channel channel) { if (channel != null) { channel.disconnect(); } } }
/** * 关闭会话通道 * * @param channel 会话通道 * @since 4.0.3 */ public static void close(Channel channel) { if (channel != null && channel.isConnected()) { channel.disconnect(); } }
/** * 关闭会话通道 * * @param channel 会话通道 * @since 4.0.3 */ public static void close(Channel channel) { if (channel != null && channel.isConnected()) { channel.disconnect(); } }
@Override public void close() throws IOException { super.close(); this.channel.disconnect(); } }
channel.disconnect(); session.disconnect();
channel.disconnect(); session.disconnect();
channel.disconnect(); session.disconnect(); } catch (Exception e) {
channel.disconnect(); session.disconnect();
channel.disconnect(); session.disconnect(); } catch (Exception e) {
try { if ( channel != null ) { channel.disconnect();
throw new Exception("Remote command not finished within " + timeoutSeconds + " seconds."); channel.disconnect(); session.disconnect(); return new SSHClientOutput(exitCode, text.toString());
try { if ( channel != null ) { channel.disconnect();
channel.disconnect(); session.disconnect(); } catch (Exception e) {
throw new Exception("Remote commmand not finished within " + timeoutSeconds + " seconds."); channel.disconnect(); session.disconnect(); return new SSHClientOutput(exitCode, text.toString());
/** * finally: will close the connection. * * @return the response on singe request */ public ResponseOnSingeRequest executeSshCommand() { ResponseOnSingeRequest sshResponse = new ResponseOnSingeRequest(); try { session = startSshSessionAndObtainSession(); channel = sessionConnectGenerateChannel(session); sshResponse = executeAndGenResponse((ChannelExec) channel); } catch (Exception e) { sshResponse = genErrorResponse(e); } finally { if (session != null) session.disconnect(); if (channel != null) channel.disconnect(); } return sshResponse; }
protected void closeQuietly(Channel channel) { if (channel != null) { channel.disconnect(); } }
@Override public void close() { if (shellChannel != null) { shellChannel.disconnect(); shellChannel = null; } session.disconnect(); session = null; }
@Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; }
@Override public void close() throws Exception { if (channel != null) { channel.disconnect(); channel = null; } if (session != null) { session.disconnect(); session = null; } }
public void close() { closed = true; for (final Channel channel : channels) if (!channel.isClosed()) channel.disconnect(); channels.clear(); librarian.checkIn(this); }