You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/09/20 02:33:23 UTC

[GitHub] [commons-vfs] destroydestiny commented on a diff in pull request #300: VFS-824 HttpFileSystem free Unused Resources lead to HttpClient Conn…

destroydestiny commented on code in PR #300:
URL: https://github.com/apache/commons-vfs/pull/300#discussion_r974831684


##########
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileProvider.java:
##########
@@ -148,6 +148,21 @@ public void freeUnusedResources() {
                                       .forEach(AbstractFileSystem::closeCommunicationLink);
     }
 
+    /**
+     * get snapshot of all fileSystem
+     *
+     * @return FileSystem Array
+     */
+    public AbstractFileSystem[] getAllFileSystemSnapshot() {

Review Comment:
   Hello @garydgregory 
   Thank for your review. This is the first time I have participated in an open source project. There are many things I don't know about in terms of specifications.
   This problem was encountered in my work, when FileSystemManager.freeUnusedResources, HttpFileSystem will close the httpClient, and using the httpClient again will report an error.
   I have two immature solutions.
   1、 Close the HttpFileSystem when FreeUnusedResources, because the httpClient it holds is closed and cannot be used again. with commit 7d263eeda5c6a8b8261be22b1891ab330f9b3a06
   2、 httpclient shared ConnectionManager.  with commit 7c09877efd490903289c44e504c48034f87f08f2
   I don't know enough about Common VFS, which is definitely not the optimal solution.
   
   This method copy from  org.apache.commons.vfs2.provider.AbstractFileProvider#freeUnusedResources.  I just close FileSystem after closeCommunicationLink .
   if return a list.clone() , need to convert List<FileSystem>  to List<AbstractFileSystem> and why not create stream manually.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org