Thanks everyone for the answers.

Raymond Auge <raymond.a...@liferay.com> schrieb am Mi., 4. Sep. 2019, 21:01:

> Lars,
>
> One way to _guarantee ordering_ (in the sense that you are assured
> something else has already occurred) is by using a _static_ @Reference to a
> service. The other service must have been "registered" and in terms of DS
> it would have to also have been activated before you're @Reference would be
> satisfied (and when static, the reference is only satisfied BEFORE
> activation).
>
> You can do this even if the other service was not published by DS.
>
> So, if Eclipse early startup has somehow registered some service you could
> get which would allow you to detect a state you're be ok to run AFTER then
> your OSGi service would be forced to wait on it using the approach above.
>
> There are many use cases like this. In fact the OSGi Alliance is working
> actively on a Condition Service Specification which is precisely this kind
> of "do something when condition X is satisfied" type of thing.
>
> - Ray
>
> On Wed, Sep 4, 2019 at 2:51 PM BJ Hargrave <hargr...@us.ibm.com> wrote:
>
>> The DS specification says nothing about what thread a DS component's
>> method is invoked upon. It may be someone else's thread or a thread that
>> SCR manages in an executor. But as a component implementer you MUST NOT
>> assume anything about the thread upon which your component's methods are
>> invoked. (Other than it is not your thread to use for long periods of time.)
>> --
>>
>> BJ Hargrave
>> Senior Technical Staff Member, IBM // office: +1 386 848 1781
>> OSGi Fellow and CTO of the OSGi Alliance // mobile: +1 386 848 3788
>> hargr...@us.ibm.com
>>
>>
>>
>> ----- Original message -----
>> From: Lars Vogel <lars.vo...@vogella.com>
>> Sent by: equinox-dev-boun...@eclipse.org
>> To: Equinox development mailing list <equinox-dev@eclipse.org>
>> Cc:
>> Subject: [EXTERNAL] Re: [equinox-dev] In which thread are OSGI services
>> started
>> Date: Wed, Sep 4, 2019 14:44
>>
>> Thanks Neil and BJ. What if I use OSGi ds (Felix) to define the service?
>>
>>
>> Best regards, Laes
>>
>> Neil Bartlett <njbartl...@gmail.com> schrieb am Mi., 4. Sep. 2019, 14:44:
>>
>> Short answer is that you should not make any assumption about the thread
>> that your component is activated.
>>
>> Long answer is that for an immediate component, it is likely to be
>> activated in whichever thread called Bundle.start(). For a lazy service
>> component, it is likely to be activated in whichever thread called
>> BundleContext.getService().
>>
>> But the outcome is the same. You are always "borrowing" a thread and
>> should never do long running work in the activate method of a component. If
>> you have any such work to do, then you should spin it out as a thread or
>> submit it to an executor service.
>>
>> Neil
>>
>> On Wed, 4 Sep 2019 at 13:41, Lars Vogel <lars.vo...@vogella.com> wrote:
>>
>> Friends of Equinox,
>>
>> If I create an immediate OSGi service, in which thread is it created?
>> How about lazy OSGi services?
>>
>> The background of my question is that I would like to replace an
>> Eclipse early startup extension with an immediate OSGi but I'm not
>> sure if that would block the main thread until the service has been
>> created.
>>
>> Best regards, Lars
>>
>> --
>> Eclipse Platform project co-lead
>> CEO vogella GmbH
>>
>> Haindaalwisch 17a, 22395 Hamburg
>> Amtsgericht Hamburg: HRB 127058
>> Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
>> USt-IdNr.: DE284122352
>> Fax (040) 5247 6322, Email: lars.vo...@vogella.com, Web:
>> http://www.vogella.com
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/equinox-dev
>>
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/equinox-dev
>>
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/equinox-dev
>>
>>
>>
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/equinox-dev
>
>
>
> --
> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>  (@rotty3000)
> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
>  (@Liferay)
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to