JSch ライブラリを使用して、SFTP サーバーからファイルを一覧表示およびダウンロードしています。
Channel channel = this.session.openChannel(SFTP_CHANNEL_NAME);
channel.connect();
sftpChannel = (ChannelSftp) channel;
Vector<LsEntry> listing = sftpChannel.ls("*");
の呼び出し中ls
に、アプリケーション スレッドがスタックすることがあります。
スレッドダンプ -
Thread 15108: (state = BLOCKED)
java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be 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)
タイムアウトを設定するls
方法やその他の方法はありますか? タイムアウトの設定を見ましたchannel.connect(timeout)
が、これはリモートサーバーへの接続中にのみタイムアウトを設定します。