java - JSCH: closing channel and session -


i'm doing sftp operation jsch:

jsch jsch = new jsch(); session session = null; channelsftp sftpchannel = null; try {     session = jsch.getsession(user, host, integer.valueof(port));     session.setconfig(jsch_options);     session.setpassword(password);     session.connect();     channel channel = session.openchannel(sftp_channel_id);     channel.connect();     sftpchannel = (channelsftp) channel;      // sftp operations  } catch (exception e) {     log.error("error while sftp session", e); } {     sftpchannel.exit();     session.disconnect(); } 

my question is: when i'm done enough call disconnect() on session object, or exit() on channel must before? thanks!

update: checked behavior , there no errors, i'm not quite sure sockets/etc cleaned correctly.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

angularjs - ng-repeat duplicating items after page reload -

javascript - What's causing this slow/delayed audio playback in Safari? -