felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1377082 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Date Fri, 24 Aug 2012 20:13:10 GMT
Author: djencks
Date: Fri Aug 24 20:13:10 2012
New Revision: 1377082

URL: http://svn.apache.org/viewvc?rev=1377082&view=rev
Log:
FELIX-3637 possibly avoid race condition

Modified:
    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/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=1377082&r1=1377081&r2=1377082&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
Fri Aug 24 20:13:10 2012
@@ -674,7 +674,7 @@ public abstract class AbstractComponentM
 
     protected void registerService( String[] provides )
     {
-            ServiceRegistration existing = m_serviceRegistration.get();
+        ServiceRegistration existing = m_serviceRegistration.get();
         if ( existing == null )
         {
             log( LogService.LOG_DEBUG, "registering services", null );
@@ -1307,24 +1307,11 @@ public abstract class AbstractComponentM
                 return;
             }
 
-            // set satisfied state before registering the service because
-            // during service registration a listener may try to get the
-            // service from the service reference which may cause a
-            // delayed service object instantiation through the State
-
-            // actually since we don't have the activating state any
-            // longer, we have to set the satisfied state already
-            // before actually creating the component such that services
-            // may be accepted.
-            final State satisfiedState = acm.getSatisfiedState();
-            acm.changeState( satisfiedState );
-
             // Before creating the implementation object, we are going to
             // test if all the mandatory dependencies are satisfied
             if ( !acm.verifyDependencyManagers( acm.getProperties() ) )
             {
                 acm.log( LogService.LOG_DEBUG, "Not all dependencies satisfied, cannot activate",
null );
-                acm.changeState( Unsatisfied.getInstance() );
                 return;
             }
 
@@ -1334,10 +1321,21 @@ public abstract class AbstractComponentM
             {
                 acm.log( LogService.LOG_DEBUG, "Component is not permitted to register all
services, cannot activate",
                     null );
-                acm.changeState( Unsatisfied.getInstance() );
                 return;
             }
 
+            // set satisfied state before registering the service because
+            // during service registration a listener may try to get the
+            // service from the service reference which may cause a
+            // delayed service object instantiation through the State
+
+            // actually since we don't have the activating state any
+            // longer, we have to set the satisfied state already
+            // before actually creating the component such that services
+            // may be accepted.
+            final State satisfiedState = acm.getSatisfiedState();
+            acm.changeState( satisfiedState );
+
             acm.registerComponentService();
 
             // 1. Load the component implementation class



Mime
View raw message