felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clement Escoffier (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-3030) Bind/Unbind and lifecycle
Date Mon, 21 Nov 2011 07:50:53 GMT

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

Clement Escoffier commented on FELIX-3030:
------------------------------------------

The issue here is the mix between the instance lifecycle (VALID / INVALID) and the service
dynamism (BIND/UNBIND). I understand your issue, but the promoted model is to clean everything
during the @Invalidate callback, and not expecting an @Unbind callback. Indeed, if we call
the unbind callback, how does the code knows if it's just an unbind of a used service or if
it's an invalidation.
                
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message