You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2006/11/07 22:57:34 UTC

svn commit: r472293 - /jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java

Author: imario
Date: Tue Nov  7 13:57:33 2006
New Revision: 472293

URL: http://svn.apache.org/viewvc?view=rev&rev=472293
Log:
VFS-98: try to avoid deadlock

Modified:
    jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java

Modified: jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java?view=diff&rev=472293&r1=472292&r2=472293
==============================================================================
--- jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java (original)
+++ jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java Tue Nov  7 13:57:33 2006
@@ -64,20 +64,24 @@
     /**
      * Locates a file from its parsed URI.
      */
-    protected synchronized FileObject findFile(final FileName name, final FileSystemOptions fileSystemOptions)
+    protected FileObject findFile(final FileName name, final FileSystemOptions fileSystemOptions)
         throws FileSystemException
     {
-        // Check in the cache for the file system
-        final FileName rootName = getContext().getFileSystemManager().resolveName(name, FileName.ROOT_PATH);
-        FileSystem fs = findFileSystem(rootName, fileSystemOptions);
-        if (fs == null)
-        {
-            // Need to create the file system, and cache it
-            fs = doCreateFileSystem(rootName, fileSystemOptions);
-            addFileSystem(rootName, fs);
-        }
+		FileSystem fs;
+		synchronized (this)
+		{
+			// Check in the cache for the file system
+			final FileName rootName = getContext().getFileSystemManager().resolveName(name, FileName.ROOT_PATH);
+			fs = findFileSystem(rootName, fileSystemOptions);
+			if (fs == null)
+			{
+				// Need to create the file system, and cache it
+				fs = doCreateFileSystem(rootName, fileSystemOptions);
+				addFileSystem(rootName, fs);
+			}
+		}
 
-        // Locate the file
+		// Locate the file
         // return fs.resolveFile(name.getPath());
         return fs.resolveFile(name);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org