The whole point of services is that the are dynamic. The fact the DS is 
"processing" them on behalf of some bundle does not mean that another 
bundle should know or observe that. 

Bundles which depend upon a service need to deal with that service's 
dynamism. You can't assume a bundle's activator or starting a bundle will 
synchronously register some services. I would not support an option for DS 
to synchronously register services during bundle start as this means 
people will improperly use that.

You may also be seeing an impedance mismatch between the lifecycle of 
extensions and services. Extensions become active when the bundle is 
resolved while services become active only when the bundle is started. 
Switching to use extensions will not allow for dynamism (unless you want 
to write all the code to use the extension registry API to do so.)

You may be able to use startlevels to mitigate the issue (make sure all 
bundles providing service B are started before bundles using B), but this 
is also a hack. It would be better if service A dealt with the dynamics of 
service B such that service A has a dynamic dependency on service B and is 
able to accept B's being registered and unregistered at any time.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[EMAIL PROTECTED]

office: +1 386 848 1781
mobile: +1 386 848 3788





From:
Stoyan Boshev <[EMAIL PROTECTED]>
To:
Equinox development mailing list <equinox-dev@eclipse.org>
Date:
2008/09/03 07:51 AM
Subject:
Re: [equinox-dev] When is DS done loading services?



Hi Otto,
I guess your problem is connected to the asynchronous processing of the 
DS services.
As far as I understand the situation is: your application bundles are 
started, then your application is started but at this moment not all of 
the DS services are inited yet because they are being asynchronously 
processed.

Unfortunately currently there is no way to find out when DS completes 
the DS services processing.
I think if there was an option that DS bundle process the DS services in 
the started bundles synchronously, it would solve your problem. So I 
will open bug(enhancement) about that and hopefully this will be 
implemented soon.
As a possible workaround you could observe the running threads and when 
the thread with name "Component Resolve Thread" disappears this would 
mean that DS bundle has no more work to do and eventually all of your DS 
services are processed. I realize this is not a clean solution (that's 
why I call it workaround) but at this moment I cannot find out a more 
appropriate working solution without modifications in the DS bundle.

Stoyan


Cortez, Otto wrote:
> I made a post to the Eclipse newcomers group a few weeks ago, but did 
> not get a response.  I don’t know if this is the appropriate place for 
> this question, but hopefully someone can point me in the right 
direction.
> 
> 
> 
> We are building a headless RCP application and we would like to use DS 
> to make functionality available.  The problem we are running into is 
> that not all of the services we declared through DS get loaded and are 
> visible before our application executes.
> 
> 
> 
> For example, I have a service A which needs 0..n instances of another 
> service B. The issue I'm running into is that if the implementations of 
> service B are spread across several bundles, then the service A will not 

> have seen all instances of service B when it is called since the 
> application starts (and sometimes ends) running before DS is done 
> looking through all the bundles and registering all the services in the 
> active bundles.
> 
> Is there a way to know when declarative services is done looking through 

> the active bundles and loading the services found in them?  Am I missing 

> something?
> 
> 
> 
> It seems that using the plug-in registry may solve this issue.  Is that 
> perhaps a better way to go?
> 
> 
> 
> Thanks,
> Otto
> 
> This email and any files transmitted with it are confidential, 
proprietary
> and intended solely for the individual or entity to whom they are 
addressed.
> If you have received this email in error please delete it immediately.
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/equinox-dev

-- 
---------------------------------------------------------
dipl. eng. Stoyan Boshev . Department manager
ProSyst Labs EOOD
1606 Sofia, Bulgaria . 48 Vladajska Str.
Tel. +359 2 953 05 88; Fax +359 2 953 26 17
Mobile: +359 88 898 29 17
http://www.prosyst.com . [EMAIL PROTECTED]
---------------------------------------------------------
stay in touch with your product
---------------------------------------------------------
_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to