Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.2
-
None
Description
The API documentation for VFS is missing advisory information about the safety (or danger) of sharing class instances across multiple threads. Refer to bugs VFS-253 and VFS-683 for examples of what can happen when the same FileObject instance is accessed in more than one thread. However, there is caching that's happening in org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile. Source code is here. This will definitely result in the same FileObject being referenced from distinct threads if both threads call resolveFile on the same instance of a FileSystem that extends AbstractFileSystem. So, it's unclear where applications that use VFS are required to apply synchronization and/or whether each thread is required to use a distinct FileSystem instance.