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