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

Felix Meschberger commented on FELIX-1185:
------------------------------------------

I have applied your latest patches and tested them in our application running 
on Felix Framework 1.6.0. I only had a small issue:

The AbstractComponentManager.Unsatisfied.activateInternal method does the 
following at the end:

            acm.registerComponentService();
            acm.changeState( acm.getSatisfiedState() );

This registers the service of the provider component causing any consumer 
components to try to get the service immediately. If the provider component is 
a service factory (delayed component), this causes the DelayedComponentManager 
to try to create the actual component instance, which fails because the state 
is not active.

The correct order here is probably:

            acm.changeState( acm.getSatisfiedState() );
            acm.registerComponentService();

thus changing the component state _before_ registering the service. This way, 
the consumer component will get the service, since the new state will be able 
to create the actual component instance and return it.

This change works in my application, you might want to verify in your 
environment.

> If a static/mandatory reference to a service is unregistered, the component 
> should be deactivated synchronously instead of asynchronously
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-1185
>                 URL: https://issues.apache.org/jira/browse/FELIX-1185
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.0.8
>            Reporter: Agemo Cui
>             Fix For: scr-1.0.10
>
>         Attachments: AbstractComponentManager.java, 
> AbstractComponentManager.java, ComponentFactoryImpl.java, scr-changes on 
> revision 778604.zip
>
>
> In the specification cmpn 112.3.3 Reference Policy, it says "Component 
> configurations are deactivated before any bound service for a reference 
> having a static policy becomes unavailable."
> My understanding is the deactivate method of the component must be called 
> before any unbind method for a static/mandatory reference is called. And it's 
> reasonable for a static/mandatory reference to be still available in the 
> deactivate method.
> If the component is deactivated asynchronously when a static/mandatory 
> reference to a service is unregistered, then it's possible that the unbind 
> method is called before the deactivate method is called, which makes the 
> service unavailable in the deactivate method.
> This bug may relate to FELIX-1178.
> The fix for this bug should also fix FELIX-1178. No need to add a new flag.

-- 
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