[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] When is DS done loading services?

Danail Nachev
Senior Software Engineer/Development Tools
ProSyst Labs EOOD
-------------------------------------------------
stay in touch with your product.
-------------------------------------------------

BJ Hargrave wrote:
> 
>> As to the question of DS, let's not forget that it is just an
>> instrument. From what I understand, its goal is to help developers
>> work around OSGi complexities. If it does not help, it needs to be fixed.
> 
> I am all for fixing DS if it is flawed. But your argument against using
> startlevel can be applied to anything which attempts to fix some
> ordering. The difficult point is that bundles can be interdependent.
> They and services are dynamic. You can attempt to hide the dynamism
> through the use of static policies in DS but that only goes so far.
> Using DS, one can fairly easily deal with service dynamism. There are
> bind/unbind methods which are called when services come and go so the
> bundle can be notified of changes to the set of services.
> 
> I feel that changing DS to perform service registration synchronous with
> bundle activation will likely result in deadlocks when there are complex
> service dependency graphs.

This won't be any different from what is done now manually. The
potential for deadlocks are there regardless of DS.

> 
> One possible way to deal with this is through the use of component
> enablement. Using the original example of service A depending upon some
> number of service B, if you can know when all the service Bs are
> available, one can write a component with a dynamic dependency on B.
> When all the Bs are available then enable the component providing
> service A (which are declared disabled in its description). The trick is
> of course to be able to know when all the service Bs are available such
> that we are ready to enable serviceA.

And we are back to the core problem: we cannot be sure when all service
Bs are available. In code which doesn't use DS, start() method will
serve as a boundary for the service changes - satisfied services will be
registered while the bundle is starting and any services which becomes
satisfied will be registered synchronously (the latter is the current
behavior of DS). After all the bundles are activated, we can be sure
that all services which doesn't depend on external factors will be
available and the system can be considered ready.

> 
> 
> -- 
> 
> *BJ Hargrave*
> Senior Technical Staff Member, IBM
> OSGi Fellow and CTO of the _OSGi Alliance_ <http://www.osgi.org/>_
> __hargrave@xxxxxxxxxxx <mailto:hargrave@xxxxxxxxxx> 	
> 
> office: +1 386 848 1781
> mobile: +1 386 848 3788
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev