Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0C7FCD41F for ; Fri, 24 Aug 2012 20:13:57 +0000 (UTC) Received: (qmail 69725 invoked by uid 500); 24 Aug 2012 20:13:56 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 69683 invoked by uid 500); 24 Aug 2012 20:13:56 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 69676 invoked by uid 99); 24 Aug 2012 20:13:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 20:13:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 20:13:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 67E4323889EB for ; Fri, 24 Aug 2012 20:13:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@felix.apache.org From: djencks@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120824201310.67E4323889EB@eris.apache.org> 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