felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre De Rop (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-5428) Dependency events set not cleared when component is removed
Date Fri, 25 Nov 2016 20:39:58 GMT
Pierre De Rop created FELIX-5428:
------------------------------------

             Summary: Dependency events set not cleared when component is removed
                 Key: FELIX-5428
                 URL: https://issues.apache.org/jira/browse/FELIX-5428
             Project: Felix
          Issue Type: Bug
          Components: Dependency Manager
    Affects Versions: org.apache.felix.dependencymanager-r1
            Reporter: Pierre De Rop
            Assignee: Pierre De Rop
             Fix For: org.apache.felix.dependencymanager-r9


During the implementation of 	FELIX-5336 (support for prototype scopes), I came across the
following problem:

1) you create a Consumer component:

dm.add(consumer):

2) the consumer depends on some services providers, so you add two providers:

dm.add(p1);
dm.add(p2);

3) you remove the consumer:

dm.remove(consumer);

at this point, the consumer is unbound from the two providers because the consumer is being
stopped, but the bug is the following: when the handleRemoved method is called, the events
are not removed from the m_dependencyEvents collection because the  m_isStarted flag is set
to true, so the two dependencies remains:

{code}
    private void handleRemoved(DependencyContext dc, Event e) {
    	try {
    		if (! m_isStarted) {
    			return;
    		}
{code}

4) now, you remove the two providers

5) you re-add the consumer and the two providers:

dm.add(consumer);
dm.add(p3);
dm.add(p4);

but when the consumer is re-added, it gets injected with the previous dependency events (the
two previous p1,p2), and this is wrong of course.








--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message