sftp - Configuring timeout on JSch ChannelSftp operations -
i using jsch library list , download files sftp server.
channel channel = this.session.openchannel(sftp_channel_name);
channel.connect();
sftpchannel = (channelsftp) channel;
vector listing = sftpchannel.ls("*");
while calling ls
, application thread getting stuck sometimes.
thread dump -
thread 15108: (state = blocked)
java.lang.object.wait(long) @bci=0 (compiled frame; information may imprecise)
java.io.pipedinputstream.read() @bci=142, line=310 (compiled frame)
java.io.pipedinputstream.read(byte[], int, int) @bci=43, line=361 (compiled frame)
com.jcraft.jsch.channelsftp.fill(byte[], int, int) @bci=17, line=2527 (compiled frame)
com.jcraft.jsch.channelsftp.header(com.jcraft.jsch.buffer, com.jcraft.jsch.channelsftp$header) @bci=12, line=2553 (interpreted frame)
com.jcraft.jsch.channelsftp.ls(java.lang.string) @bci=298, line=1424 (interpreted frame)
is there way configure timeout on ls
, other methods? saw setting timeout on channel.connect(timeout)
sets timeout while connecting remote server.
the correct way prevent commands sticking set serveraliveinterval on session. sourcecode:
/** * sets interval send keep-alive message. if 0 * specified, keep-alive message must not sent. default interval * zero. * @param interval specified interval, in milliseconds. * @see #getserveraliveinterval() */ public void setserveraliveinterval(int interval) throws jschexception { settimeout(interval); this.serveraliveinterval=interval; }
Comments
Post a Comment