1
나는 sauronsoftware.ftp4j.FTPClient을 사용하여 FTP 서버에서 예약 된 파일 다운로드를 수행합니다. 내 문제는 클라이언트가 파일을 다운로드하는 동안 FTP 서버가 갑자기 작동하지 않는다는 것입니다. 별도의 스레드에서 실행하고 FTP 서버가이 스레드를 죽을 때 영원히처럼 어쨌든 계속 실행ftp4j 클라이언트가 파일을 다운로드하는 동안 FTP 서버가 사망합니다
for (FTPFile remoteFile : remoteFiles) {
String remoteFileName = remoteFile.getName();
String localPath = ftpDir.getLocalPath() + remoteFileName;
log.debug("Downloading remote file {} to local path {}", remoteFileName, localPath);
try {
client.download(remoteFileName, new File(localPath));
if (!ftpDir.isLeaveFilesOnServer()) {
//Delete remote file
client.deleteFile(remoteFileName);
}
} catch (IllegalStateException e) {
log.error("FTPException ",e);
fcr.addErrorFile(remoteFileName);
} catch (IOException e) {
log.error("FTPException ",e);
문제는 그 다운로드 (...)입니다 : 이 내가하는 일입니다. 이 문제를 해결할 수있는 방법이 있습니까? 아니면 이와 같은 문제를 처리 할 수있는 다른 FTP 클라이언트를 사용해야합니까?
를 종료하기 전에 완료 될 때까지 메인 쓰레드가 대기 할 수 있도록 'commons-net'을 사용합니까? http://commons.apache.org/proper/commons-net/examples/ftp/FTPClientExample.java – longhua