Hi Neil,
Thanks for the quick reply.
okay I see, I misinterpreted the specs then.
In my specific case, I need to make sure the static reference is there
*before* the dynamic ones. What is the best patterns to ensure that ? Do I
need to write synchonization code inside my component for that, or do you
know a cleaner way with declarative services ?
Thanks!
Nicolas
On Mon, Nov 28, 2016 at 12:13 PM, Neil Bartlett <njbartlett@gmail.com>
wrote:
>
> > On 28 Nov 2016, at 11:09, Nicolas Brasey <nicolas.brasey@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I have a bind order issue with a component that has :
> >
> > 1) A static reference specified with annotation @Reference on the private
> > field
> > 2) A dynamic multiple reference specificed with annotation on a method
> >
> > The static reference is not bound before the dynamic ones.
>
>
> That is not required. Dynamic references can be bound, unbound or replaced
> at any time… even potentially *while* the static references are being
> bound, or while the activate is executing.
>
>
> >
> > The code looks like this:
> >
> > @Component(immediate = true)
> > public class MyServiceImpl implements MyService {
> >
> > @Reference
> > private AclService aclService;
> >
> > @Reference(
> > cardinality = ReferenceCardinality.MULTIPLE,
> > policy = ReferencePolicy.DYNAMIC
> > )
> > public void add(StateMachine stateMachine) {
> > ....
> > ....
> > }
> >
> >
> > According to the Declarative Service specifications, the static
> references
> > should always be injected before the activate method.
>
>
> That’s correct.
>
>
> >
> >
> > Does anyone have any idea what might be wrong ?
>
>
> It doesn’t sound like anything is going wrong.
>
> Regards,
> Neil
>
>
> >
> >
> > My env is Apache Karaf 4.0.5 with Felix SCR 2.0.2
> >
> >
> > Thanks for you help!
> >
> > Nicolas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
|