Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0DE3174E0 for ; Mon, 29 Aug 2011 13:38:05 +0000 (UTC) Received: (qmail 88068 invoked by uid 500); 29 Aug 2011 13:38:04 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 88007 invoked by uid 500); 29 Aug 2011 13:38:04 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 87922 invoked by uid 99); 29 Aug 2011 13:38:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2011 13:38:03 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2011 13:38:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3B9EDD5017 for ; Mon, 29 Aug 2011 13:37:40 +0000 (UTC) Date: Mon, 29 Aug 2011 13:37:40 +0000 (UTC) From: "Marco Crivellaro (JIRA)" To: dev@camel.apache.org Message-ID: <1116802875.3149.1314625060240.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1680633252.52860.1313760267090.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CAMEL-4356) faster way of testing for file existence MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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