Class AsyncFileTransferClient

java.lang.Object
com.enterprisedt.net.ftp.SecureFileTransferClient
com.enterprisedt.net.ftp.AsyncFileTransferClient
All Implemented Interfaces:
FileTransferClientInterface

public class AsyncFileTransferClient extends SecureFileTransferClient
FTP client class supporting multiple protocols that permits asynchronous FTP operations. Together with the connection pool inherited from SecureFileTransferClient, this means that multiple simultaneous file transfers can be performed in the background.

A simple example of connecting asynchronously is shown below. The MyConnectTest class is implementing the callback, passing itself via the 'this' reference into connectAsync():

 public class MyConnectTest implements Connect {
 
  private AsyncFileTransferClient client = new AsyncFileTransferClient();
 
  public void startConnecting() {
    client.setRemoteHost(host);
    client.setUserName(user);
    client.setPassword(password);
    client.connectAsync(this, null);
  }
 
  public void onConnect(ConnectResult result)
    throws FTPException, IOException {
    result.endAsync();
    System.out.println("Connected!")
  }
 
Users should note that calling asyncConnect() starts a pool of worker threads and the connection pool. This means that asyncDisconnect() (or disconnect()) must be called to stop the worker threads, otherwise applications will hang on exit as threads will still be alive.

Version:
$Revision$
Author:
Bruce Blackshaw
  • Constructor Details

    • AsyncFileTransferClient

      public AsyncFileTransferClient(int initialPoolSize, int maxPoolSize)
      Constructor. Initialises the class.
      Parameters:
      poolsize - size of connection pool (i.e. number of managed connections)
    • AsyncFileTransferClient

      public AsyncFileTransferClient()
      Default constructor. Uses defaults for pool sizes.
  • Method Details

    • setContentType

      public void setContentType(FTPTransferType type) throws IOException, FTPException
      Set the transfer type, either ASCII or binary. Setting applies to all subsequent transfers that are initiated. It does not apply to transfers currently in progress.If called within a callback, will only apply to the callback context, not to all connections.
      Specified by:
      setContentType in interface FileTransferClientInterface
      Overrides:
      setContentType in class SecureFileTransferClient
      Parameters:
      type - transfer type
      Throws:
      FTPException
      IOException
      FTPException
    • getContentType

      public FTPTransferType getContentType()
      Get the current content type. If called within a callback, will only apply to the callback context, not to all connections.
      Specified by:
      getContentType in interface FileTransferClientInterface
      Overrides:
      getContentType in class SecureFileTransferClient
      Returns:
      transfer type
    • setDetectContentType

      public void setDetectContentType(boolean detectContentType)
      Set auto detect of filetypes on or off. If on, the transfer mode is switched from ASCII to binary and vice versa depending on the extension of the file. After the transfer, the mode is always returned to what it was before the transfer was performed. The default is off. If called within a callback, will only apply to the callback context, not to all connections. If the filetype is unknown, the transfer mode is unchanged
      Specified by:
      setDetectContentType in interface FileTransferClientInterface
      Overrides:
      setDetectContentType in class SecureFileTransferClient
      Parameters:
      detectContentType - true if detecting content type, false if not
    • isDetectContentType

      public boolean isDetectContentType()
      Get the detect content type flag. If called within a callback, will only apply to the callback context, not to all connections.
      Specified by:
      isDetectContentType in interface FileTransferClientInterface
      Overrides:
      isDetectContentType in class SecureFileTransferClient
      Returns:
      true if we are detecting binary and ASCII transfers from the file type
    • connectAsync

      public ConnectResult connectAsync(AsyncCallback.Connect callback, Object tag) throws FTPException
      Make an asynchronous connection to the FTP server. A number of connections are made - that number being equal to the size of the FTP connection pool.
      Parameters:
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback). Can be set to null.
      Returns:
      result object
      Throws:
      FTPException
    • executeCommandAsync

      public ExecuteCommandResult executeCommandAsync(String command, AsyncCallback.ExecuteCommand callback, Object tag) throws FTPException
      Request that the remote server execute the literal command supplied. In FTP and SFTP, this might be a SITE command, while in SFTP it might be a shell command.

      It is up to the user to send a sensible command.

      Parameters:
      command - command string
      Returns:
      result string by server
      Throws:
      FTPException
      IOException
    • getSystemTypeAsync

      public GetSystemTypeResult getSystemTypeAsync(AsyncCallback.GetSystemType callback, Object tag) throws FTPException
      Get a string that represents the remote system that the client is logged into.
      Parameters:
      command - command string
      Returns:
      result string by server
      Throws:
      FTPException
      IOException
    • directoryNameListAsync

      public DirectoryNameListResult directoryNameListAsync(String directoryName, boolean isLongListing, AsyncCallback.DirectoryNameList callback, Object tag) throws FTPException
      List a directory on the FTP server asynchronously.
      Parameters:
      directoryName - name of the directory (generally not a path)
      isLongListing - true if the listing is a long format listing
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • directoryListAsync

      public DirectoryListResult directoryListAsync(String directoryName, AsyncCallback.DirectoryList callback, Object tag) throws FTPException
      List a directory on the FTP server asynchronously.
      Parameters:
      directoryName - name of the directory (generally not a path)
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadByteArrayAsync

      public DownloadByteArrayResult downloadByteArrayAsync(String remoteFileName, AsyncCallback.DownloadByteArray callback, Object tag) throws FTPException
      Download a file from the FTP server asynchronously to a byte array
      Parameters:
      remoteFileName - name of the remote file to be downloaded
      callback - callback to be notified when download is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadFileAsync

      public DownloadFileResult downloadFileAsync(String localFileName, String remoteFileName, WriteMode writeMode, AsyncCallback.DownloadFile callback, Object tag) throws FTPException
      Download a file from the FTP server asynchronously.
      Parameters:
      localFileName - name (or full path) of the local file to be downloaded to
      remoteFileName - name of the remote file to be downloaded
      writeMode - mode in which the file is written to the server
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadStreamAsync

      public DownloadStreamResult downloadStreamAsync(String remoteFileName, AsyncCallback.DownloadStream callback, Object tag) throws FTPException
      Download a file from the FTP server as a stream, asynchronously.
      Parameters:
      remoteFileName - name of the remote file to be downloaded
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadFileAsync

      public UploadFileResult uploadFileAsync(String localFileName, String remoteFileName, AsyncCallback.UploadFile callback, Object tag) throws FTPException
      Upload a file to the FTP server asynchronously. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from .
      Parameters:
      localFileName - name (or full path) of the local file to be downloaded to
      remoteFileName - name of the remote file to be downloaded (or null to generate a unique name)
      callback - callback to be notified when upload is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadFileAsync

      public UploadFileResult uploadFileAsync(String localFileName, String remoteFileName, WriteMode writeMode, AsyncCallback.UploadFile callback, Object tag) throws FTPException
      Upload a file to the FTP server asynchronously. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from .
      Parameters:
      localFileName - name (or full path) of the local file to be downloaded to
      remoteFileName - name of the remote file to be downloaded (or null to generate a unique name)
      writeMode - mode in which the file is written to the server
      callback - callback to be notified when upload is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadByteArrayAsync

      public UploadByteArrayResult uploadByteArrayAsync(byte[] bytes, String remoteFileName, WriteMode writeMode, AsyncCallback.UploadByteArray callback, Object tag) throws FTPException
      Upload a byte array to the FTP server asynchronously. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from .
      Parameters:
      bytes - byte array to upload
      remoteFileName - name of the remote file
      writeMode - mode in which the file is written to the server
      callback - callback to be notified when upload is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadStreamAsync

      public UploadStreamResult uploadStreamAsync(String remoteFileName, AsyncCallback.UploadStream callback, Object tag) throws FTPException
      Upload a file to the FTP server by writing to a stream, asynchronously. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from .
      Parameters:
      remoteFileName - name of the remote file to be uploaded
      callback - callback to be notified when upload is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadStreamAsync

      public UploadStreamResult uploadStreamAsync(String remoteFileName, WriteMode writeMode, AsyncCallback.UploadStream callback, Object tag) throws FTPException
      Upload a file to the FTP server by writing to a stream, asynchronously. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from .
      Parameters:
      remoteFileName - name of the remote file to be uploaded
      writeMode - mode in which the file is written to the server
      callback - callback to be notified when upload is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • getSizeAsync

      public SizeResult getSizeAsync(String remoteFileName, AsyncCallback.Size callback, Object tag) throws FTPException
      Get the size of a remote file asynchronously.
      Parameters:
      remoteFileName - name of remote file
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • getModifiedTimeAsync

      public ModifiedTimeResult getModifiedTimeAsync(String remoteFileName, AsyncCallback.GetModifiedTime callback, Object tag) throws FTPException
      Get the modified-time of a remote file asynchronously.
      Parameters:
      remoteFileName - name of remote file
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • setModifiedTimeAsync

      public ModifiedTimeResult setModifiedTimeAsync(String remoteFileName, Date modifiedTime, AsyncCallback.SetModifiedTime callback, Object tag) throws FTPException
      Set the modified-time of a remote file asynchronously.
      Parameters:
      remoteFileName - name of remote file
      modifiedTime - modified time to set
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • setPermissionsAsync

      public PermissionsResult setPermissionsAsync(String remotePath, int permissions, AsyncCallback.SetPermissions callback, Object tag) throws FTPException, IOException
      Set the permissions of the supplied file or directory. Only supported in SFTP.

      Absolute modes are octal numbers specifying the complete list of attributes for the files; you specify attributes by OR'ing together these bits. These must be octal numbers, and are listed below.

       0400       Individual read
       0200       Individual write
       0100       Individual execute (or list directory)
       0040       Group read
       0020       Group write
       0010       Group execute
       0004       Other read
       0002       Other write
       0001       Other execute 
       
      For example, for individual read, write and execute only, 0700 should be supplied (0400 | 0200 | 0100).
      Parameters:
      remotePath - path of file or directory
      permissions - octal permissions (must be preceded with a '0').
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
      IOException
    • existsAsync

      public ExistsResult existsAsync(String remoteFileName, AsyncCallback.Exists callback, Object tag) throws FTPException
      Determine asynchronously if a remote file exists.
      Parameters:
      remoteFileName - name of remote file
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • deleteFileAsync

      public DeleteFileResult deleteFileAsync(String remoteFileName, AsyncCallback.DeleteFile callback, Object tag) throws FTPException
      Deletes a remote file asynchronously.
      Parameters:
      remoteFileName - name of remote file
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • deleteMultipleFilesAsync

      public DeleteMultipleFilesResult deleteMultipleFilesAsync(FileFilter filter, AsyncCallback.DeleteMultipleFiles callback, Object tag) throws FTPException
      Deletes remote files in the current directory that match the supplied wildcard
      Parameters:
      filter - filename filter
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Throws:
      FTPException
      IOException
    • deleteMultipleFilesAsync

      public DeleteMultipleFilesResult deleteMultipleFilesAsync(String wildcard, AsyncCallback.DeleteMultipleFiles callback, Object tag) throws FTPException
      Deletes remote files in the current directory that match the supplied wildcard
      Parameters:
      wildcard - wildcard string (supporting '*' and '?')
      Throws:
      FTPException
      IOException
    • deleteMultipleFilesAsync

      public DeleteMultipleFilesResult deleteMultipleFilesAsync(String remoteDirectory, String wildcard, boolean recursive, AsyncCallback.DeleteMultipleFiles callback, Object tag) throws FTPException
      Deletes remote files that match the supplied wildcard in the supplied remote directory asynchronously.
      Parameters:
      remoteDirectory - name of remote directory
      wildcard - wildcard string (supporting '*' and '?')
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • deleteMultipleFilesAsync

      public DeleteMultipleFilesResult deleteMultipleFilesAsync(String remoteDirectory, FileFilter filter, boolean recursive, AsyncCallback.DeleteMultipleFiles callback, Object tag) throws FTPException
      Deletes remote files that match the supplied wildcard in the supplied remote directory asynchronously.
      Parameters:
      remoteDirectory - name of remote directory
      filter - filename filter
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • renameAsync

      public RenameResult renameAsync(String renameFromName, String renameToName, AsyncCallback.Rename callback, Object tag) throws FTPException
      Rename a remote file asynchronously.
      Parameters:
      renameFromName - original name
      renameToName - new name
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • changeDirectory

      public void changeDirectory(String directoryName) throws FTPException, IOException
      Change directory on the FTP server. The working directory for subsequent asynchronous operations will be changed also.
      Specified by:
      changeDirectory in interface FileTransferClientInterface
      Overrides:
      changeDirectory in class SecureFileTransferClient
      Parameters:
      directoryName - name the remote directory to change into
      Throws:
      FTPException
      IOException
    • changeDirectoryAsync

      public ChangeDirectoryResult changeDirectoryAsync(String directoryName, AsyncCallback.ChangeDirectory callback, Object tag) throws FTPException
      Change directory on the FTP server asynchronously. . All async operations performed after this has completed will use the new directory.
      Parameters:
      directoryName - name the remote directory to change into
      callback - callback to be notified when the directory change is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • changeToParentDirectoryAsync

      public ChangeDirectoryResult changeToParentDirectoryAsync(AsyncCallback.ChangeDirectory callback, Object tag) throws FTPException
      Change directory on the FTP server asynchronously.
      Parameters:
      callback - callback to be notified when the directory change is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • createDirectoryAsync

      public CreateDirectoryResult createDirectoryAsync(String directoryName, AsyncCallback.CreateDirectory callback, Object tag) throws FTPException
      Change directory on the FTP server asynchronously.
      Parameters:
      directoryName - name the remote directory to change into
      callback - callback to be notified when the directory change is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • deleteDirectoryAsync

      public DeleteDirectoryResult deleteDirectoryAsync(String directoryName, AsyncCallback.DeleteDirectory callback, Object tag) throws FTPException
      Delete a directory on the FTP server asynchronously. The directory must be empty, and not the current directory.
      Parameters:
      directoryName - name the remote directory to delete
      callback - callback to be notified when the directory change is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • deleteDirectoryAsync

      public DeleteDirectoryResult deleteDirectoryAsync(String directoryName, boolean recursive, AsyncCallback.DeleteDirectory callback, Object tag) throws FTPException
      Delete a directory on the FTP server asynchronously, and optionally sub-directories. The directory must not be the current directory. The directory must be empty for a non-recursive delete.
      Parameters:
      directoryName - name the remote directory to delete
      recursive -
      callback - callback to be notified when the directory delete is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadMultipleAsync

      public UploadMultipleResult uploadMultipleAsync(String localDir, FileFilter filter, AsyncCallback.UploadMultiple callback, Object tag) throws FTPException
      Uploads local files from the supplied local directory that match the supplied FileFilter into the current remote directory. Not recursive. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      filter - filename filter
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadMultipleAsync

      public UploadMultipleResult uploadMultipleAsync(String localDir, String wildcard, AsyncCallback.UploadMultiple callback, Object tag) throws FTPException
      Uploads local files from the supplied local directory that match the supplied wildcard into the current remote directory. Not recursive. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      wildcard - wildcard filter for files to be uploaded (supports '*' and '?')
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadMultipleAsync

      public UploadMultipleResult uploadMultipleAsync(String localDir, String remoteDir, String wildcard, boolean recursive, AsyncCallback.UploadMultiple callback, Object tag) throws FTPException
      Uploads local files from the supplied local directory that match the supplied wildcard into the supplied remote directory. If recursive is set to true, goes through all subdirectories. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      wildcard - wildcard filter for files to be uploaded (supports '*' and '?')
      recursive - if true, operation is recursive through subdirectories
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • uploadMultipleAsync

      public UploadMultipleResult uploadMultipleAsync(String localDir, String remoteDir, FileFilter filter, boolean recursive, AsyncCallback.UploadMultiple callback, Object tag) throws FTPException
      Uploads local files from the supplied local directory that match the supplied wildcard into the supplied remote directory. If recursive is set to true, goes through all sub-directories. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      filter - filename filter for files to be uploaded
      recursive - if true, operation is recursive through sub-directories
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadMultipleAsync

      public DownloadMultipleResult downloadMultipleAsync(String localDir, FileFilter filter, AsyncCallback.DownloadMultiple callback, Object tag) throws FTPException
      Downloads remote files to the supplied local directory that match the supplied wildcard from the current remote directory. Not recursive. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      filter - filename filter
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadMultipleAsync

      public DownloadMultipleResult downloadMultipleAsync(String localDir, String wildcard, AsyncCallback.DownloadMultiple callback, Object tag) throws FTPException
      Downloads remote files to the supplied local directory that match the supplied wildcard from the current remote directory. Not recursive. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      wildcard - wildcard filter for files to be uploaded (supports '*' and '?')
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadMultipleAsync

      public DownloadMultipleResult downloadMultipleAsync(String localDir, String remoteDir, String wildcard, boolean recursive, AsyncCallback.DownloadMultiple callback, Object tag) throws FTPException
      Downloads remote files to the supplied local directory that match the supplied wildcard from the current remote directory. If recursive is set to true, goes through all sub-directories. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      wildcard - wildcard filter for files to be uploaded (supports '*' and '?')
      recursive - if true, operation is recursive through sub-directories
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • downloadMultipleAsync

      public DownloadMultipleResult downloadMultipleAsync(String localDir, String remoteDir, FileFilter filter, boolean recursive, AsyncCallback.DownloadMultiple callback, Object tag) throws FTPException
      Downloads remote files to the supplied local directory that match the supplied wildcard from the current remote directory. If recursive is set to true, goes through all sub-directories. Operation is asynchronous.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      filter - filename filter for files to be uploaded
      recursive - if true, operation is recursive through sub-directories
      callback - callback to be notified when operation is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • setDisconnectCallback

      public void setDisconnectCallback(AsyncCallback.Disconnect callback)
      Set the callback that is called for all disconnects - deliberate and resulting from timeout or error.
      Parameters:
      callback - callback to notify
    • getDisconnectCallback

      public AsyncCallback.Disconnect getDisconnectCallback()
      Get the currently set disconnect callback.
      Returns:
      callback notified on disconnection
    • disconnectAsync

      public DisconnectResult disconnectAsync(AsyncCallback.Disconnect callback, Object tag) throws FTPException
      Disconnect from the FTP server asynchronously. All connections in the FTP connection pool are disconnected. It is not an abrupt disconnection -
      Parameters:
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException
    • disconnectAsync

      public DisconnectResult disconnectAsync(boolean immediate, AsyncCallback.Disconnect callback, Object tag) throws FTPException
      Disconnect from the FTP server asynchronously. All connections in the FTP connection pool are disconnected.
      Parameters:
      immediate - if set to true, immediately kills connections
      callback - callback to be notified when connection is completed
      tag - any object reference can be saved in this tag and can be accessed later from the result object (e.g. in the callback).
      Returns:
      result object
      Throws:
      FTPException