Hello Pierre
Thanks. Indeed my additional conditions were not added atomically.

Should the setInstanceBound(true) be called on each dependency separately before being added to the list? Does setInstanceBound() make only sense on adapters or should I call it for all type of components when dependencies are added in init()? (the JavaDoc " Sets this dependency to be instance bound or not." is not so helpful).

Is it only for adapters that additional conditions must be added atomically or for all type of components?

Regards Philipp


On 30.09.2014 23:03, Pierre De Rop wrote:
Hello Philipp,

I don't know if this may help, but if you are using DM 3.2.0, please don't
forget that if you are declaring some extra-service dependencies from your
init() methods (in your adapter for example), then you have to declare them
as "instance bound" dependencies: you have to make a call to the
setInstanceBound(true) method on the extra dependency declared from your
init methods.

And also, if you have more than one dependency to add in your init()
method, then you should add them atomically using a list of Dependencies,
passed to the dm.add(List dependencies) method.

You can take a look at [1] for an example.

kind regards;
/Pierre

[1]
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/integration/api/MultipleExtraDependenciesTest.java?revision=1532440&view=markup

On Tue, Sep 30, 2014 at 7:46 PM, Bulu <b...@romandie.com> wrote:

Obviously it works great on the small example... :-)
Ergo: the problem is in my code or more complex than explained...


On 30.09.2014 19:14, Marcel Offermans wrote:

On 30 Sep 2014, at 9:50 am, Bulu <b...@romandie.com> wrote:

  Hi all
Using DM I declare adapter services like this

// without filter
mgr.add(createAdapterService(SomeClass.class,null)
                 .setImplementation(...)
                 .setCallbacks(...));

// with filter
String someFilter = ...
mgr.add(createAdapterService(OtherClass.class, someFilter))
                 .setImplementation(...)
                 .setCallbacks(...));

I notice that, if I first start this adapter bundle and later the
SomeClass and OtherClass appear, all get picked up correctly and forwarded
to the callbacks.

However, if first the SomeClass and OtherClass service are present and
later the Adapter gets started, it only picks up the ones without filter
(in the example the "SomeClass", but not the "OtherClass" services).

I know the filter is correct, as it does work when done in the right
order. The services are the same in both cases.

Has anybody else noticed this? Is the problem in my code?

Not sure, could you provide a small working example or test?

Greetings, Marcel


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


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



Reply via email to