SpringBoot笔记:SpringBoot集成FTP(连接池)、SFTP(连接池)
躺着听Jay:
大概一百M嘛,前端请求下载,一直卡在这,应该是卡着不动了。就是这个方法,一直卡在ftpPoolService.returnObject(ftpClient);这里。
public InputStream downFile(String sourceFileName, String dirPath) throws IOException {
FTPClient ftpClient = ftpPoolService.borrowObject();
// 切换工作目录
ftpClient.changeWorkingDirectory(dirPath);
InputStream result = null;
try {
result = ftpClient.retrieveFileStream(sourceFileName);
// ftpClient.completePendingCommand();
} catch (Exception e) {
log.error("deleteFile error ", e);
} finally {
ftpPoolService.returnObject(ftpClient);
}
return result;
}
|