I'm looking into using Apache Commons VFS for a project that will need to transfer files between local server and remote servers via ftp, sftp and https.
The standard usage examples are getting the FileSystemManager from a static method
FileSystemManager fsManager = VFS.getManager();
Is it safe to use the same FileSystemManager across multiple threads?
And a second question is about properly releasing resources in a finally block: I find the following methods in the Javadoc API:
- http://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/FileObject.html#close()
- http://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/FileSystemManager.html#closeFileSystem(org.apache.commons.vfs2.FileSystem)
- http://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/FilesCache.html#close()
- http://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/impl/DefaultFileSystemManager.html#close()
But it's not clear to me which of these resources should typically be closed.