felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1181999 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl: BundleComponentActivator.java manager/AbstractComponentManager.java
Date Tue, 11 Oct 2011 18:22:18 GMT
Author: fmeschbe
Date: Tue Oct 11 18:22:18 2011
New Revision: 1181999

URL: http://svn.apache.org/viewvc?rev=1181999&view=rev
Log:
FELIX-3126 Don't try to enable to activate components while the owning bundle's controller
is being stopped.

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java?rev=1181999&r1=1181998&r2=1181999&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
Tue Oct 11 18:22:18 2011
@@ -333,12 +333,13 @@ public class BundleComponentActivator im
 
 
     /**
-     * Returns <true> if this instance is active, that is if components may be
-     * activated for this component. As soon as the {@link #dispose()} is called
-     * which means this instance is being shutdown. After the call to <code>dispose</code>
-     * this method always returns <code>false</code>.
+     * Returns <true> if this instance is active, that is if components
+     * may be activated for this component. The active flag is set early
+     * in the constructor indicating the activator is basically active
+     * (not fully setup, though) and reset early in the process of
+     * {@link #dispose(int) disposing} this instance.
      */
-    boolean isActive()
+    public boolean isActive()
     {
         return m_active;
     }

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=1181999&r1=1181998&r2=1181999&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Tue Oct 11 18:22:18 2011
@@ -479,6 +479,14 @@ public abstract class AbstractComponentM
         return m_activator;
     }
 
+
+    boolean isActivatorActive()
+    {
+        BundleComponentActivator activator = getActivator();
+        return activator != null && activator.isActive();
+    }
+
+
     final ServiceRegistration getServiceRegistration()
     {
         return m_serviceRegistration;
@@ -919,6 +927,13 @@ public abstract class AbstractComponentM
 
         void enable( AbstractComponentManager acm )
         {
+            if ( !acm.isActivatorActive() )
+            {
+                acm.log( LogService.LOG_DEBUG, "Bundle's component activator is not active;
not enabling component",
+                    null );
+                return;
+            }
+
             acm.changeState( Enabling.getInstance() );
             acm.registerComponentId();
             try
@@ -985,6 +1000,13 @@ public abstract class AbstractComponentM
 
         void activate( AbstractComponentManager acm )
         {
+            if ( !acm.isActivatorActive() )
+            {
+                acm.log( LogService.LOG_DEBUG, "Bundle's component activator is not active;
not activating component",
+                    null );
+                return;
+            }
+
             acm.changeState( Activating.getInstance() );
 
             acm.log( LogService.LOG_DEBUG, "Activating component", null );



Mime
View raw message