[英]How to get Bundle Activator Instance to call a method after all bundles are activated
I need to call a method with bundle activator instance after every bundle is started.我需要在每个包启动后调用一个带有包激活器实例的方法。 I have five bundles.我有五个包。 How do I get the bundle activator instance?如何获取捆绑激活器实例? Requirement: Call a method only with the activator instance.要求:仅使用激活器实例调用方法。
Look into using EventHandler (or perhaps BundleTracker depending on your use case).考虑使用 EventHandler(或者 BundleTracker,具体取决于您的用例)。 OSGi defines a FrameworkEvent that an EventHandler will receive. OSGi 定义了 EventHandler 将接收的 FrameworkEvent。 You could configure your second stage to trigger based on the 'STARTED' event.您可以将第二阶段配置为根据“开始”事件触发。
alternatively: org.osgi.util.tracker.BundleTracker或者:org.osgi.util.tracker.BundleTracker
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.