[ 
https://issues.apache.org/jira/browse/VFS-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17109974#comment-17109974
 ] 

Rémi Villé commented on VFS-771:
--------------------------------

setCacheStrategy() forbids to change the cache strategy if the 
FileSystemManager has been initialized.
When I use VFS.getManager() this call initialize the default FileSystemManager 
so I cannot change the strategy.
I tried to create my own manager by extending FileSystemManager (and then 
VFS.setManager(customFSManager)), but after that I use 
DefaultFileSystemConfigBuilder.getInstance() and 
SftpFileSystemConfigBuilder.getInstance() to set some SFTP settings like 
authenticator, userinfo, identityinfo, etc, unfortunately these calls seem to 
still use the old default FileSystemManager.

My workaroud is to remove the first call to sftpFile.findFiles(selector) as I 
only used it to compare the number of downloaded files with the call to 
localFile.copyFrom(sftpFile, selector).
In fact I'm not sure of the relevance of such a test as if an issue occurs 
during copyFrom() it should throw an exception.

> SFTP multiple get bad performances if copyFrom() called after findFiles()
> -------------------------------------------------------------------------
>
>                 Key: VFS-771
>                 URL: https://issues.apache.org/jira/browse/VFS-771
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.4.1, 2.6.0
>            Reporter: Rémi Villé
>            Priority: Major
>
> Similar to VFS-698: if you call sftpFile.findFiles(selector) before 
> localFile.copyFrom(sftpFile, selector) the second call reset file stats in 
> the cache (in .AbstractFileSystem#resolveFile() =>
> {code:java}
> if 
> (getFileSystemManager().getCacheStrategy().equals(CacheStrategy.ON_RESOLVE)) {
>  file.refresh();
> }
> {code}
> )
> Then the stats are retrieved one by one which result in poor performances.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to