Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will eclipse/osgi activators always be called at least once before code is accessed?

In Eclipse (3.3) I have a plugin User, depending on plugin Provider. Provider has an activator. On the Plugin Editor for provider it has a checkbox "Activate this plug-in when one of its classes is loaded". Checking/unchecking this will change a Manifest setting : Eclipse-LazyStart to true/false.

My question is that the checkbox, to me, implies that the activator may not be run if it's unchecked, whereas the setting implies that the activator will always be run, just whether you want it to load with eclipse or not.

  1. If you have an activator will it always have run at least once before a downstream plugin calls code, regardless of this checkbox?
  2. Does this checkbox only apply to immediate or lazy starting?
like image 412
AntóinÓg Avatar asked Jan 24 '23 08:01

AntóinÓg


1 Answers

Eclipse-LazyStart: true -> means the plugin will be automatically started when a class in that plugin is loaded.
Eclipse-LazyStart: false -> means the plugin/bundle will not be started when a class in that plugin is loaded. It will need an explicit Bundle#start() call from you instead of an automatic start from the Equinox OSGI framework.

So yes, this checkbook only apply to that setting.
Note: with OSGI4.1, that may also set the new Bundle-ActivationPolicy setting.

From OSGI design:

Lazy Activation

Lazy activation is a life cycle policy that mandates a bundle MUST be activated upon the first successful request to load a class from that bundle.
Sometimes this is referred to as auto starting because the bundle is automatically activated upon first class load.
This design will always use the term lazy instead of auto because auto starting can imply that a bundle is always automatically started every time the framework is launched.

The choices here are "lazy-start vs no-start", not "lazy-start vs eager-start".
So even with an Activator, your plugin Provider will not start until one of its class is loaded (lazy-start true) and explicitly called (if lazy start false)

like image 187
VonC Avatar answered Jan 25 '23 20:01

VonC