felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r812916 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java
Date Wed, 09 Sep 2009 12:10:53 GMT
Author: pauls
Date: Wed Sep  9 12:10:52 2009
New Revision: 812916

URL: http://svn.apache.org/viewvc?rev=812916&view=rev
Log:
Fix potential deadlock when framework is shutdown and a url is created on the outside at the
same time (FELIX-1565).

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java?rev=812916&r1=812915&r2=812916&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java Wed Sep
 9 12:10:52 2009
@@ -521,6 +521,7 @@
     **/
     public static void unregisterFrameworkInstance(Object framework)
     {
+        boolean unregister = false;
         synchronized (m_frameworks)
         {
             m_counter--;
@@ -528,24 +529,28 @@
             {    
                 if (m_frameworks.isEmpty())
                 {
-                    try
-                    {
-                        m_secureAction.invoke(m_secureAction.getDeclaredMethod(
-                            m_rootURLHandlers.getClass(), 
-                            "unregisterFrameworkListsForContextSearch", 
-                            new Class[]{ ClassLoader.class}), 
-                            m_rootURLHandlers,
-                            new Object[] {URLHANDLERS_CLASS.getClassLoader()});
-                    }
-                    catch (Exception e)
-                    {
-                        // TODO: this should not happen
-                        e.printStackTrace();
-                    }
+                    unregister = true;
                     m_handler = null;
                 }
             }
         }
+        if (unregister)
+        {
+             try
+             {
+                 m_secureAction.invoke(m_secureAction.getDeclaredMethod(
+                     m_rootURLHandlers.getClass(), 
+                     "unregisterFrameworkListsForContextSearch", 
+                     new Class[]{ ClassLoader.class}), 
+                     m_rootURLHandlers,
+                     new Object[] {URLHANDLERS_CLASS.getClassLoader()});
+             }
+             catch (Exception e)
+             {
+                 // TODO: this should not happen
+                 e.printStackTrace();
+             }
+        }
     }
 
     /**



Mime
View raw message