[
https://issues.apache.org/jira/browse/CAMEL-11792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276311#comment-16276311
]
Himanshu Mittal commented on CAMEL-11792:
-----------------------------------------
I debugged this camel-ftp code further and figured out the root cause.
In {{org.apache.camel.component.file.GenericFileProducer}} 's
{{processExchange}} method.
During temp file creation there is a check to delete pre existing temp file.
operation.existFile(tempTarget) will invoke client.listNames(name) from
commons.net. And it creates a connection internally
{code}
// delete any pre existing temp file
if (operations.existsFile(tempTarget)) {
log.trace("Deleting existing temp file: {}", tempTarget);
if (!operations.deleteFile(tempTarget)) {
throw new GenericFileOperationFailedException("Cannot
delete file: " + tempTarget);
}
}
{code}
Now if this check is conditional based on {{fileExist}} check in endpoint. We
can avoid additional connection and socket in TIME_WAIT
> New ftp connection for each file transfer with tempFileName option in URI
> -------------------------------------------------------------------------
>
> Key: CAMEL-11792
> URL: https://issues.apache.org/jira/browse/CAMEL-11792
> Project: Camel
> Issue Type: Bug
> Components: camel-ftp
> Affects Versions: 2.19.2
> Reporter: Himanshu Mittal
> Priority: Minor
> Attachments: TestFTPConnection.java
>
>
> When we have {{tempFilename}} in camel uri and we use producer template to
> write file to remote ftp location , camel opens new connection for every file
> transfer. Though disconnect option is set to false in uri.
> If we take out tempFilename from uri connections are reused
> We can verify it by running attached sample.
> Check the connections made from camel server to ftp server . Fire {{netstat
> -an|grep 10.80.14.56|wc -l]]
> - When we have tempFileName in uri it will show 1 connection per file transfer
> - Without tempFileName it will show only 1 connection for all files transfer.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)