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

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

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
            Priority: Minor


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

        

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

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CAMEL-4356:
-------------------------------

    Fix Version/s: 2.8.2

> 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.8.2, 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

        

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

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092742#comment-13092742 ] 

Willem Jiang commented on CAMEL-4356:
-------------------------------------

I committed a patch by introducing a new option of "fastExist".

> 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
>
> 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

        

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

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092767#comment-13092767 ] 

Claus Ibsen commented on CAMEL-4356:
------------------------------------

I would suggest the option would be named: fastExistsCheck
As its more descriptive what it does: to enable checking for file exists using a faster way.

> 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
>
> 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

        

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

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092830#comment-13092830 ] 

Willem Jiang commented on CAMEL-4356:
-------------------------------------

Just a commit a new patch by changing the option name, as this is new feature to camel-ftp, I think it just be a part of camel 2.9.0.

> 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
>
> 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

        

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

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-4356:
-----------------------------------

    Assignee: Willem Jiang

> 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
>
> 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113220#comment-13113220 ] 

Marco Crivellaro commented on CAMEL-4356:
-----------------------------------------

Can you update the documentation so that it states the option is available for Camel 2.8.2 too (like ciphers option)?



> 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.8.2, 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092816#comment-13092816 ] 

Marco Crivellaro commented on CAMEL-4356:
-----------------------------------------

I agree fastExistsCheck is more descriptive option name

> 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
>
> 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092831#comment-13092831 ] 

Marco Crivellaro commented on CAMEL-4356:
-----------------------------------------

any chance to get it as 2.8.1?

> 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
>
> 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092722#comment-13092722 ] 

Marco Crivellaro commented on CAMEL-4356:
-----------------------------------------

I could not find any incident related to listing using filename in the forum.
Both libraries API reports listing with filename as a possible use of list so I would think this should not cause errors.

To be on the safe side though it would be nice to introduce listing by filename as an optional behaviour.

> 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
>
> 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Crivellaro updated CAMEL-4356:
------------------------------------

    Comment: was deleted

(was: I agree fastExistsCheck is more descriptive option name)

> 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
>
> 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

        

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

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091762#comment-13091762 ] 

Claus Ibsen commented on CAMEL-4356:
------------------------------------

Some FTP server may not allow listing using a name parameter. I think in the past there has been some issue about that.
So please check the mailing list for past talks about this.

If there is something about this, we may need to add an option so people can turn this on|off according to whatever works.

> 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
>
> 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

        

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

Posted by "Marco Crivellaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092817#comment-13092817 ] 

Marco Crivellaro commented on CAMEL-4356:
-----------------------------------------

I agree fastExistsCheck is more descriptive option name

is this going to be release with a 2.8.x version or 2.9.0?

> 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
>
> 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