You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2011/08/29 15:43:37 UTC

[jira] [Resolved] (CAMEL-4356) faster way of testing for file existence

     [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-4356.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.9.0

Update the ftp2 wiki page for the new option of fastExistsCheck.

> faster way of testing for file existence
> ----------------------------------------
>
>                 Key: CAMEL-4356
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4356
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-ftp
>    Affects Versions: 2.8.0
>            Reporter: Marco Crivellaro
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> when storing a file the ftp component checks if the file exists in the endpoint, this is done by listing the content of the destination folder and looping through all files listed. 
> the list operation takes a long time when the destination folder contains hundreds of files. 
> instead of listing for all files the component can simply list for the file it is interested on, this way the number of files contained in destination folder won't affect the time it takes the producer to process the exchange. 
> I currently have a case where delivering to an endpoint is taking more than a minute because of this issue. 
> Both ftp and sftp libraries used supports listing for a single file so the changes would be the following: 
> {code:title=FtpOperations.java}
> public boolean existsFile(String name) throws GenericFileOperationFailedException { 
>   String[] names = client.listNames(name); 
>   if (names == null) { 
>     return false; 
>   } 
>   return (names.lenght >= 1); 
> } 
> {code}
> {code:title=SftpOperations.java}
> public boolean existsFile(String name) throws GenericFileOperationFailedException { 
>   Vector files = channel.ls(name); 
>   if (names == null) { 
>     return false; 
>   } 
>   return (names.size >= 1); 
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira