Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

Mycroft

Posts

1

Joined

Tue May 10, 2011 7:53 pm

FTPClient: check isInterrupted() during file transfers

by Mycroft » Tue May 10, 2011 8:23 pm

I am using version 2.2.2 of the edtftpj Java library inside a JBoss environment and it works well in general. But unfortunately the only way to stop a running download is to call FileTransferClient.cancelAllTransfers() which calls through to FTPClient.cancelTransfer(). This sets an interal flag to true which is checked within the while-loop of the getDataAfterInitGet(OutputStream) method.

In order to stop a running download a separate thread is required. But creating threads in Java EE is bad style and should be avoided.

When the JVM shuts down, all running threads will be interrupt()-ed. Therefore implementations should check isInterrupted() from time to time and cancel whatever they are doing as soon as this method returns true. Could such a check be added to the while-loop (line 3196) in the next version of the library?

Who is online

Users browsing this forum: No registered users and 98 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron