/** * Adds a file system to those cached by this provider. * <p> * The file system may implement {@link VfsComponent}, in which case it is initialised. * * @param key The root file of the file system, part of the cache key. * @param fs the file system to add. * @throws FileSystemException if any error occurs. */ protected void addFileSystem(final Comparable<?> key, final FileSystem fs) throws FileSystemException { // Add to the container and initialize addComponent(fs); final FileSystemKey treeKey = new FileSystemKey(key, fs.getFileSystemOptions()); ((AbstractFileSystem) fs).setCacheKey(treeKey); fileSystems.put(treeKey, fs); }
/** * Adds a file system to those cached by this provider. * <p> * The file system may implement {@link VfsComponent}, in which case it is initialised. * * @param key The root file of the file system, part of the cache key. * @param fs the file system to add. * @throws FileSystemException if any error occurs. */ protected void addFileSystem(final Comparable<?> key, final FileSystem fs) throws FileSystemException { // Add to the container and initialize addComponent(fs); final FileSystemKey treeKey = new FileSystemKey(key, fs.getFileSystemOptions()); ((AbstractFileSystem) fs).setCacheKey(treeKey); synchronized (fileSystems) { fileSystems.put(treeKey, fs); } }
/** * Adds a file system to those cached by this provider. * <p> * The file system may implement {@link VfsComponent}, in which case it is initialised. * * @param key The root file of the file system, part of the cache key. * @param fs the file system to add. * @throws FileSystemException if any error occurs. */ protected void addFileSystem(final Comparable<?> key, final FileSystem fs) throws FileSystemException { // Add to the container and initialize addComponent(fs); final FileSystemKey treeKey = new FileSystemKey(key, fs.getFileSystemOptions()); ((AbstractFileSystem) fs).setCacheKey(treeKey); synchronized (fileSystems) { fileSystems.put(treeKey, fs); } }
/** * Adds a file system to those cached by this provider. The file system * may implement {@link VfsComponent}, in which case it is initialised. * * @return A FileSystem which was added, or which was already added if that key * already hade associated one */ protected FileSystem addFileSystem(final Comparable<?> key, final FileSystem fs) throws FileSystemException { final FileSystemKey treeKey = new FileSystemKey(key, fs.getFileSystemOptions()); ((AbstractFileSystem) fs).setCacheKey(treeKey); //[IntelliJ] WI-31041 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ FileSystem existingFileSystem; synchronized (myFileSystemsLock) { existingFileSystem = fileSystems.get(treeKey); if (existingFileSystem == null) { // Add to the cache addComponent(fs); fileSystems.put(treeKey, fs); return fs; } } ((AbstractFileSystem) fs).close(); return existingFileSystem; //[IntelliJ] WI-31041 ------------------------------------------------------------- }