Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Question about Bundle-ActivationPolicy: lazy and Activators

> On 7 Oct 2015, at 09:24, Lars Vogel <lars.vogel@xxxxxxxxxxx> wrote:
> 
> Thanks Neil.
> 
> So to summaries: without the "lazy" flag my activator is only started
> if I do this explicit, i.e., it is not started without my code.

Technically, OSGi never starts a bundle unless somebody calls the Bundle.start() method. In an Eclipse application, the “somebody” who starts most of the bundles is p2 (org.eclipse.equinox.simpleconfigurator).

P2 calls start(Bundle.START_ACTIVATION_POLICY) on all bundles that have Bundle-ActivationPolicy: lazy in their manifest. All other bundles are not started at all.

> So to
> ensure the Activator runs, the flag is needed. (Unless I would start
> the bundles somewhere in my code).

This only ensures that the activator runs if you know that a class will be loaded from the bundle. Aside from that, the only way to really *ensure* that a bundle is started is to edit configuration/config.ini.


> 
> Best regards, Lars
> 
> On Wed, Oct 7, 2015 at 10:13 AM, Neil Bartlett <njbartlett@xxxxxxxxx> wrote:
>> It depends what you want to achieve.
>> 
>> If you want the activator to run lazily, only when a class is loaded from the bundle for some other reason (eg because it contributes an extension) then that is exactly what BAP:lazy does.
>> 
>> If you don't have that class loading trigger, then you will have to find a way to start the bundle non-lazily (in this case the BAP:lazy is not needed, but also doesn't hurt anything). Unfortunately in Eclipse it's very hard to actually start a bundle, because the platform doesn't want you to.
>> 
>> Neil
>> 
>> 
>>> On 7 Oct 2015, at 08:58, Lars Vogel <lars.vogel@xxxxxxxxxxx> wrote:
>>> 
>>> Hi,
>>> 
>>> I have a plug-in with an activator. It also sets the
>>> Bundle-ActivationPolicy: lazy policy set, even though it provides no
>>> declarative services nor any others services.
>>> 
>>> id State       Bundle
>>> 208 ACTIVE      org.eclipse.ui.cheatsheets_3.4.200.N20151006-2000
>>> osgi> services 208
>>> "No registered services."
>>> 
>>> Do I still have to set the Bundle-ActivationPolicy: lazy policy set?
>>> The Activator is definitely used in the code.
>>> 
>>> Best regards, Lars
>>> 
>>> --
>>> Eclipse Platform UI and e4 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 (032) 221739404, 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://dev.eclipse.org/mailman/listinfo/equinox-dev
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/equinox-dev
> 
> 
> 
> -- 
> Eclipse Platform UI and e4 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 (032) 221739404, 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://dev.eclipse.org/mailman/listinfo/equinox-dev



Back to the top