@Override public void close() { if (this.session != null) { this.session.disconnect(); } }
/** * 关闭SSH连接会话 * * @param key 主机,格式为user@host:port */ public void close(String key) { Session session = sessionPool.get(key); if (session != null && session.isConnected()) { session.disconnect(); } sessionPool.remove(key); }
/** * 关闭SSH连接会话 * * @param key 主机,格式为user@host:port */ public void close(String key) { Session session = sessionPool.get(key); if (session != null && session.isConnected()) { session.disconnect(); } sessionPool.remove(key); }
@Override protected void doCloseCommunicationLink() { if ( this.session != null ) { this.session.disconnect(); this.session = null; } super.doCloseCommunicationLink(); }
public void disconnect() { if ( c != null ) { c.disconnect(); } if ( s != null ) { s.disconnect(); } }
/** * 关闭所有SSH连接会话 */ public void closeAll() { Collection<Session> sessions = sessionPool.values(); for (Session session : sessions) { if (session.isConnected()) { session.disconnect(); } } sessionPool.clear(); } }
/** * 关闭所有SSH连接会话 */ public void closeAll() { Collection<Session> sessions = sessionPool.values(); for (Session session : sessions) { if (session.isConnected()) { session.disconnect(); } } sessionPool.clear(); } }
/** * 关闭SSH连接会话 * * @param session SSH会话 */ public static void close(Session session) { if (session != null && session.isConnected()) { session.disconnect(); } JschSessionPool.INSTANCE.remove(session); }
/** * 关闭SSH连接会话 * * @param session SSH会话 */ public static void close(Session session) { if (session != null && session.isConnected()) { session.disconnect(); } JschSessionPool.INSTANCE.remove(session); }
@Override public void close() throws IOException { if (null == sftp) { return; } try { if (null != session) { session.disconnect(); } } catch (final Exception ex) { /*IGNORE*/ logger.warn("Unable to disconnect session due to " + ex); if (logger.isDebugEnabled()) { logger.warn("", ex); } } try { if (null != sftp) { sftp.exit(); } } catch (final Exception ex) { /*IGNORE*/ logger.warn("Unable to disconnect session due to " + ex); if (logger.isDebugEnabled()) { logger.warn("", ex); } } } }
session.disconnect();
@Override public void close() throws IOException { if (closed) { return; } closed = true; try { if (null != sftp) { sftp.exit(); } } catch (final Exception ex) { logger.warn("Failed to close ChannelSftp due to {}", new Object[] {ex.toString()}, ex); } sftp = null; try { if (null != session) { session.disconnect(); } } catch (final Exception ex) { logger.warn("Failed to close session due to {}", new Object[] {ex.toString()}, ex); } session = null; }
session.disconnect();
session.disconnect();
session.disconnect();
return false; } finally { session.disconnect();
session.disconnect(); } catch (Exception e) { System.out.println(e);
session.disconnect();
public synchronized void close() throws IOException { if (closed) { return; } super.close(); closed = true; if (!channel.isConnected()) { throw new IOException(E_CLIENT_NOTCONNECTED); } try { Session session = channel.getSession(); channel.disconnect(); session.disconnect(); } catch (JSchException e) { throw new IOException(StringUtils.stringifyException(e)); } } }
void disconnect(ChannelSftp channel) throws IOException { if (channel != null) { // close connection if too many active connections boolean closeConnection = false; synchronized (this) { if (liveConnectionCount > maxConnection) { --liveConnectionCount; con2infoMap.remove(channel); closeConnection = true; } } if (closeConnection) { if (channel.isConnected()) { try { Session session = channel.getSession(); channel.disconnect(); session.disconnect(); } catch (JSchException e) { throw new IOException(StringUtils.stringifyException(e)); } } } else { returnToPool(channel); } } }