[ 
https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783169#action_12783169
 ] 

Felix Meschberger commented on FELIX-1903:
------------------------------------------

Hmm, this is strange since there are tests which ensure this exact situation. 
Looking at the code it also shows, that it should really work: In step (2) a 
ConfiguredComponentHolder is created and provided with the configuration, which 
in turn causes the configuration to be set and the component to be activated. 
See ConfigurationComponentRegistry.createComponentHolder.

I may of course be wrong, and I will verify this later.

> SCR sometimes does not activate components when configuration-policy is 
> required
> --------------------------------------------------------------------------------
>
>                 Key: FELIX-1903
>                 URL: https://issues.apache.org/jira/browse/FELIX-1903
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux fc10/jdk1.5
>            Reporter: Pierre De Rop
>         Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: 
> http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", 
> meaning that it must not be activated before the corresponding PID is 
> available.
> But, even if SCR firsts detects that the pid is available, the component is 
> then not activated, and ends up with the following log: "Missing required 
> configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything 
> is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what 
> is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to 
> SCR, by calling the ConfigurationComponentRegistry.configurationEvent() 
> method.
> But in this method, the getComponent(pid) returns null, because the 
> component's bundle is probably not yet started, at the time we are called by 
> CM.
> 2) Next, the component's bundle is started, and the Component Actor thread 
> invokes ImmediatComponentManager.activateInternal() method, which invokes 
> activate() in the Unsatisfied state, 
> 3) but, then, the hasConfiguration() method is invoked and returns null, and 
> we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just 
> have modified the ImmediateComponentManager.hasConfiguration() in order to 
> check if the PID is available from CM. 
> (Well, admittedly, the patch is probably dirty and I have added a static 
> method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to