在访问代码之前,eclipse/osgi 激活器是否总是至少被调用一次?
在 Eclipse (3.3) 中,我有一个插件 User,具体取决于插件 Provider。 提供者有一个激活器。 在提供程序的插件编辑器上,它有一个复选框“加载其类之一时激活此插件”。 选中/取消选中此项将更改清单设置:Eclipse-LazyStart 为 true/false。
我的问题是,对我来说,该复选框意味着如果未选中,激活器可能不会运行,而该设置意味着激活器将始终运行,无论您是否希望它与 Eclipse 一起加载。
- 如果你有激活器会吗 之前总是至少运行过一次 下游插件调用代码,无论此复选框如何?
- 该复选框仅适用于 立即启动还是延迟启动?
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.
- If you have an activator will it
always have run at least once before a
downstream plugin calls code, regardless of this checkbox? - Does this checkbox only apply to
immediate or lazy starting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Eclipse-LazyStart: true ->
表示当加载该插件中的类时,该插件将自动启动。Eclipse-LazyStart: false -> 表示加载该插件中的类时不会启动插件/包。 它将需要您显式的
Bundle#start()
调用,而不是从 Equinox OSGI 框架自动启动。所以是的,此支票簿仅适用于该设置。
注意:对于 OSGI4.1,还可以设置新的
Bundle-ActivationPolicy
设置。来自 OSGI 设计:
这里的选择是“延迟启动与不启动”,而不是“延迟启动与急切启动”。
因此,即使使用激活器,您的插件提供程序也不会启动,直到其类之一被加载(
lazy-start true
)并显式调用(如果lazy start false
)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 explicitBundle#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:
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 (iflazy start false
)