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

Felix Meschberger commented on FELIX-3754:
------------------------------------------

This is not about getService. This is what happens:

  Component references Service S (0..n, dynamic)
  Component is activated (activate is called)
  During activate Service S is registered
  ServiceEvent for S is sent
  DependencyManager for Component gets event and tries to bind
  Since the DependencyManager does not know the component instance yet, it 
cannot bind
  ServiceEvent handling terminates
  Component terminates activation

At the end Service S registered from the Component's activation method is never 
bound to the Component. This is certainly not spec compliant.
                
> Services registered from within the activate method may not be bound
> --------------------------------------------------------------------
>
>                 Key: FELIX-3754
>                 URL: https://issues.apache.org/jira/browse/FELIX-3754
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-1.6.4
>
>
> The Sling POST Servlet registers a number of services in the activate method 
> and expects these services to be bound to itself. With SCR 1.6.0 this worked 
> because each component instance had its dependency managers configured with 
> its component instance.
> As of SCR 1.6.2 the DependencyManager instances are shared amongst all 
> component instances and thus don't have a reference to the component 
> instances. Instead actually bind, unbind and update services the 
> DependencyManager instances call the respective component manager which then 
> dispatches to the component instances.
> At the point in time when the activate method is called (in the 
> ImmediateComponentManager.createComponentInstance method) the actual 
> component instance is not "registered" with the component manager yet and 
> thus a bind call while the activate method is called cannot be satisfied.
> To fix this, the component instance must be "registered" with the component 
> manager before calling the activate method. If the activate method fails, the 
> instance must of course be "unregistered" again.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to