felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yann Diorcet (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-3030) Bind/Unbind and lifecycle
Date Thu, 07 Jul 2011 13:18:16 GMT
Bind/Unbind and lifecycle
-------------------------

                 Key: FELIX-3030
                 URL: https://issues.apache.org/jira/browse/FELIX-3030
             Project: Felix
          Issue Type: Bug
          Components: iPOJO
    Affects Versions: iPOJO-1.8.0
            Reporter: Yann Diorcet


According to my post(http://old.nabble.com/iPojo-lifecycle-and-dependencies-p32003301.html).
It seems that there is a problem with the lifecycle and dependencies.

@Component
@Instantiate
public final class Abcd {
    @Requires
    private Efg efg;

    @Validate
    private void start() {
    }

    @Invalidate
    private void stop() {
    }

    @Bind(aggregate = true, optional = true)
    private void bindXyz(final Xyz service) {
    }
    @Unbind
    private void unbindXyz(final Xyz service) {
    }
}

Scenario 1:
-A new service(Efg1) provides Efg
-A new service(Xyz1) provides Xyz 
-The component Abcd is instantiated
-The bind() is called with Xyz1
-The start() of the component is called
-The Efg1 is unregistered
-The component is invalidated (Efg1 is gone) stop() is called
-During the time that my component is invalidated, if a new Xyz service(Xyz2) is registred
(from an another bundle for example) bindXyz() is called
-After that, if i stop my bundle, my component will be stopped but unbindXyz() will be not
called(neither for Xyz1 nor Xyz2).

Scenario 2:
-A new service(Efg1) provides Efg
-A new service(Xyz1) provides Xyz 
-The component Abcd is instantiated
-The bind() is called with Xyz1
-The start() of the component is called
-The Efg1 is unregistered
-The component is invalidated (Efg1 is gone) stop() is called
-A new service(Efg2) provides Efg
-The start() of the component is called

Why all the already existing services are bound at the creation of the component and not unbound
at the "destruction" of the component?
Another solution: Why don't bind the optional services at the validation of the component
and unbind them at the invalidation (like it seems to be done with not optional service)?


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message