felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1421962 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Date Fri, 14 Dec 2012 16:23:23 GMT
Author: gnodet
Date: Fri Dec 14 16:23:22 2012
New Revision: 1421962

URL: http://svn.apache.org/viewvc?rev=1421962&view=rev
Log:
[FELIX-3807] Make sure bundle locks are always acquired during refresh to ensure bundles are
stopped

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

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1421962&r1=1421961&r2=1421962&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Fri Dec 14 16:23:22
2012
@@ -4706,18 +4706,21 @@ public class Felix extends BundleImpl im
 
         public void stop()
         {
-// TODO: LOCKING - This is not really correct.
-            if (m_bundle.getState() == Bundle.ACTIVE)
+            acquireBundleLock(m_bundle,
+                    Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING |
+                    Bundle.ACTIVE | Bundle.STOPPING);
+            try
             {
-                m_oldState = Bundle.ACTIVE;
-                try
-                {
-                    stopBundle(m_bundle, false);
-                }
-                catch (Throwable ex)
-                {
-                    fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex);
-                }
+                m_oldState = m_bundle.getState();
+                stopBundle(m_bundle, false);
+            }
+            catch (Throwable ex)
+            {
+                fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex);
+            }
+            finally
+            {
+                releaseBundleLock(m_bundle);
             }
         }
 



Mime
View raw message