You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Reto Bachmann-Gmuer <re...@trialox.org> on 2010/04/10 20:10:14 UTC

late static optional references not injected

I have a component with a reference as follows:

@Reference(name="globalMenuItemsProvider",
        cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE,
        policy=ReferencePolicy.STATIC,
        referenceInterface=GlobalMenuItemsProvider.class)

with scr 1.0.6 every service of that interface got injected (and the
component deactivated and reactivated), with scr 1.4.0 the component only
gets the services available when it is activated, services showing up later
are ignored.

I was expecting the behavior as provided by 1.0.6. I've also tried
1.4.1-SNAPSHOT with the same results.

Cheers,
reto

Re: late static optional references not injected

Posted by Reto Bachmann-Gmuer <re...@trialox.org>.
Hi Felix,

thanks for the info, yes 1.4.1-SNAPSHOT behaves the same as 1.4.0, sorry for
the unclear phrasing.

Cheers,
reto

On Sat, Apr 10, 2010 at 8:53 PM, Felix Meschberger <fm...@gmail.com>wrote:

> Hi,
>
> On 10.04.2010 20:10, Reto Bachmann-Gmuer wrote:
> > I have a component with a reference as follows:
> >
> > @Reference(name="globalMenuItemsProvider",
> >         cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE,
> >         policy=ReferencePolicy.STATIC,
> >         referenceInterface=GlobalMenuItemsProvider.class)
> >
> > with scr 1.0.6 every service of that interface got injected (and the
> > component deactivated and reactivated), with scr 1.4.0 the component only
> > gets the services available when it is activated, services showing up
> later
> > are ignored.
>
> Yes, this is correct.
>
> The problem is, that the 1.0.6 behaviour is incorrect because newly
> registered services must not be provided to statically bound references
> once the component is activated.
>
> If you want get updates on newly arriving services after the component
> has been activated, you have to declare them as dynamic references.
>
> >
> > I was expecting the behavior as provided by 1.0.6. I've also tried
> > 1.4.1-SNAPSHOT with the same results.
>
> I assume you mean 1.4.1-SNAPSHOT has the same behaviour as 1.0.4, right ?
>
> Regards
> Felix
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: late static optional references not injected

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

On 10.04.2010 20:10, Reto Bachmann-Gmuer wrote:
> I have a component with a reference as follows:
> 
> @Reference(name="globalMenuItemsProvider",
>         cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE,
>         policy=ReferencePolicy.STATIC,
>         referenceInterface=GlobalMenuItemsProvider.class)
> 
> with scr 1.0.6 every service of that interface got injected (and the
> component deactivated and reactivated), with scr 1.4.0 the component only
> gets the services available when it is activated, services showing up later
> are ignored.

Yes, this is correct.

The problem is, that the 1.0.6 behaviour is incorrect because newly
registered services must not be provided to statically bound references
once the component is activated.

If you want get updates on newly arriving services after the component
has been activated, you have to declare them as dynamic references.

> 
> I was expecting the behavior as provided by 1.0.6. I've also tried
> 1.4.1-SNAPSHOT with the same results.

I assume you mean 1.4.1-SNAPSHOT has the same behaviour as 1.0.4, right ?

Regards
Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org