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

Felix Meschberger commented on FELIX-1044:
------------------------------------------

Applied the following fix in Rev. 766652


  * Rename DependencyManager.close() method to DependencyManager.dispose()
      this is the opposite method to the constructor and dispose marks this 
relation better than close

  * Rename DependencyManager.bind(Object) to open(Object)
      indicates that the DependencyManager is now bound to the component 
instance and should handle (bind) references

  * Rename DependencyManager.unbind(Object) method to close()
       this is the counterpart to the new open(Object) method and renaming is 
logical. In addition the instance parameter
       is not needed anymore because it is kept in a file of the 
DependencyManager instance

  * Changed invokeBindMethod and invokeUnbindMethod signatures to not take an 
object parameter anymore since
       these methods can rely on the field referring to the component instance

  * invokeUnbindMethod does not return a value anymore because this return 
value is not used anyway

  * Added lots of logging (mostly DEBUG) to the DependencyManager class

> DependencyManager may miss service registrations
> ------------------------------------------------
>
>                 Key: FELIX-1044
>                 URL: https://issues.apache.org/jira/browse/FELIX-1044
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.0.6
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>
> Instances of the DependencyManager class are used to track component 
> references and to call the bind/unbind methods as appropriate.
> There are timing issues, which may cause instances of this class to miss 
> services.
> The serviceAdded method checks whether the component is active before 
> handling a service registration. Generally this works because the activation 
> of the component will call the bind() method for all dependency managers. The 
> problem arises if the service is registered _after_ the DependencyManager has 
> bound registered services but before the component is fully active (e.g. 
> while the activate() method is still running): In this case the service is 
> received but not bound because the component is activating and because the 
> dependency manager has already been called to bind to registered services, 
> the registering service is lost.
> An approach to explore is to ignore the component state when deciding on 
> whether to handle the event or not but to add a flag: The flag indicates 
> whether the DependencyManager.bind method has already been called and hence 
> future events should be handled. When the DependencyManager.unbind method is 
> called, the flag should be cleare to prevent event handling. In other words:
>    * Add boolean flag "open"
>    * Add open(Object) method to be called during activation. This binds 
> existing services and sets the "open" flag
>    * Rename undinb(Object) called during deactivation to close(Object) . This 
> unbinds all bound services and clears the "open" flag
>    * Add a check for the "open" flag to the serviceChanged method
>    * Remove the "handleEvent" method, whose functionality is replaced by the 
> "open" 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