You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2016/11/25 20:42:58 UTC

[jira] [Resolved] (FELIX-5428) Dependency events set not cleared when component is removed

     [ https://issues.apache.org/jira/browse/FELIX-5428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre De Rop resolved FELIX-5428.
----------------------------------
    Resolution: Fixed

committed the fix in revision 1771379.

also added the org.apache.felix.dm.itest.api.FELI5428_CleanupDependenciesWhenComponentIsStopped testcase.

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