commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r520070 - /jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
Date Mon, 19 Mar 2007 19:47:14 GMT
Author: imario
Date: Mon Mar 19 12:47:13 2007
New Revision: 520070

URL: http://svn.apache.org/viewvc?view=rev&rev=520070
Log:
VFS-112: avoid deadlock under some circumstances

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

Modified: jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java?view=diff&rev=520070&r1=520069&r2=520070
==============================================================================
--- jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
(original)
+++ jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
Mon Mar 19 12:47:13 2007
@@ -504,30 +504,36 @@
      */
     private void fireEvent(final AbstractFileChangeEvent event)
     {
-        synchronized (listenerMap)
+		FileListener[] fileListeners = null;
+		final FileObject file = event.getFile();
+
+		synchronized (listenerMap)
         {
-            final FileObject file = event.getFile();
             final ArrayList listeners = (ArrayList) listenerMap.get(file.getName());
             if (listeners != null)
             {
-            	FileListener[] fileListeners = (FileListener[]) listeners.toArray(new FileListener[listeners.size()]);
-                for (int i = 0; i < fileListeners.length; i++)
-                {
-                    final FileListener fileListener = fileListeners[i];
-                    try
-                    {
-                        event.notify(fileListener);
-                    }
-                    catch (final Exception e)
-                    {
-                        final String message = Messages.getString("vfs.provider/notify-listener.warn",
file);
-                        // getLogger().warn(message, e);
-                        VfsLog.warn(getLogger(), log, message, e);
-                    }
-                }
-            }
-        }
-    }
+            	fileListeners = (FileListener[]) listeners.toArray(new FileListener[listeners.size()]);
+			}
+		}
+
+		if (fileListeners != null)
+		{
+			for (int i = 0; i < fileListeners.length; i++)
+			{
+				final FileListener fileListener = fileListeners[i];
+				try
+				{
+					event.notify(fileListener);
+				}
+				catch (final Exception e)
+				{
+					final String message = Messages.getString("vfs.provider/notify-listener.warn", file);
+					// getLogger().warn(message, e);
+					VfsLog.warn(getLogger(), log, message, e);
+				}
+			}
+		}
+	}
 
 	/*
 	void fileDetached(FileObject fileObject)



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


Mime
View raw message