Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] In which thread are OSGI services started

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.vogel@xxxxxxxxxxx> 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.vogel@xxxxxxxxxxx, Web: http://www.vogella.com
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/equinox-dev

Back to the top